OILS / opy / _regtest / src / opy / tests / genexpr.py View on Github | oils.pub

28 lines, 10 significant
1#!/usr/bin/env python
2"""
3Test for generator expressions.
4"""
5
6def MakeLookup(p):
7 #return dict([(pat, tok) for _, pat, tok in p])
8 # Something is broken about how we compile this...
9 # Difference in compilation is SETUP_LOOP. So CPython handle this fine,
10 # but bytern doesn't.
11 return dict((pat, tok) for _, pat, tok in p)
12
13 # This should be an error but isn't. Looks like it's not compiled
14 # correctly.
15 #return list(i for (i, j) in p)
16
17fake_pairs = [
18 (False, '-a', 0),
19 (False, '-b', 1),
20 (False, '-c', 2),
21 #(False, '-d', 3),
22 #(False, '-e', 4),
23 #(False, '-f', 5),
24]
25#lookup = MakeLookup(id_kind.ID_SPEC.LexerPairs(Kind.BoolUnary))
26lookup = MakeLookup(fake_pairs)
27print('LOOKUP ***************', len(lookup))
28print(lookup)