Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_parser.py @ 14984:ece6c19edcc1 legacy-trunk
Remove some debugging prints.
| author | Greg Ward <gward@python.net> |
|---|---|
| date | Tue, 03 Oct 2000 03:32:37 +0000 |
| parents | b5fb175ad528 |
| children | 34058af976ce |
| rev | line source |
|---|---|
|
14214
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
1 import os.path |
|
14111
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
2 import parser |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
3 import pprint |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
4 import sys |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
5 |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
6 from parser import expr, suite, sequence2ast |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
7 from test_support import verbose |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
8 |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
9 # |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
10 # First, we test that we can generate trees from valid source fragments, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
11 # and that these valid trees are indeed allowed by the tree-loading side |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
12 # of the parser module. |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
13 # |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
14 |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
15 def roundtrip(f, s): |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
16 st1 = f(s) |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
17 t = st1.totuple() |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
18 st2 = parser.sequence2ast(t) |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
19 |
|
14214
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
20 def roundtrip_fromfile(filename): |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
21 roundtrip(suite, open(filename).read()) |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
22 |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
23 def test_expr(s): |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
24 print "expr:", s |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
25 roundtrip(expr, s) |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
26 |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
27 def test_suite(s): |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
28 print "suite:", s |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
29 roundtrip(suite, s) |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
30 |
|
14111
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
31 |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
32 print "Expressions:" |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
33 |
|
14214
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
34 test_expr("foo(1)") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
35 test_expr("[1, 2, 3]") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
36 test_expr("[x**3 for x in range(20)]") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
37 test_expr("[x**3 for x in range(20) if x % 3]") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
38 test_expr("foo(*args)") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
39 test_expr("foo(*args, **kw)") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
40 test_expr("foo(**kw)") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
41 test_expr("foo(key=value)") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
42 test_expr("foo(key=value, *args)") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
43 test_expr("foo(key=value, *args, **kw)") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
44 test_expr("foo(key=value, **kw)") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
45 test_expr("foo(a, b, c, *args)") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
46 test_expr("foo(a, b, c, *args, **kw)") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
47 test_expr("foo(a, b, c, **kw)") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
48 test_expr("foo + bar") |
|
14111
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
49 |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
50 print |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
51 print "Statements:" |
|
14214
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
52 test_suite("print") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
53 test_suite("print 1") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
54 test_suite("print 1,") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
55 test_suite("print >>fp") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
56 test_suite("print >>fp, 1") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
57 test_suite("print >>fp, 1,") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
58 |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
59 # expr_stmt |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
60 test_suite("a") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
61 test_suite("a = b") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
62 test_suite("a = b = c = d = e") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
63 test_suite("a += b") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
64 test_suite("a -= b") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
65 test_suite("a *= b") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
66 test_suite("a /= b") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
67 test_suite("a %= b") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
68 test_suite("a &= b") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
69 test_suite("a |= b") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
70 test_suite("a ^= b") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
71 test_suite("a <<= b") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
72 test_suite("a >>= b") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
73 test_suite("a **= b") |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
74 |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
75 #d = os.path.dirname(os.__file__) |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
76 #roundtrip_fromfile(os.path.join(d, "os.py")) |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
77 #roundtrip_fromfile(os.path.join(d, "test", "test_parser.py")) |
|
14111
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
78 |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
79 # |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
80 # Second, we take *invalid* trees and make sure we get ParserError |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
81 # rejections for them. |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
82 # |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
83 |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
84 print |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
85 print "Invalid parse trees:" |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
86 |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
87 def check_bad_tree(tree, label): |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
88 print |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
89 print label |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
90 try: |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
91 sequence2ast(tree) |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
92 except parser.ParserError: |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
93 print "caught expected exception for invalid tree" |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
94 pass |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
95 else: |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
96 print "test failed: did not properly detect invalid tree:" |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
97 pprint.pprint(tree) |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
98 |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
99 |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
100 # not even remotely valid: |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
101 check_bad_tree((1, 2, 3), "<junk>") |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
102 |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
103 # print >>fp, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
104 tree = \ |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
105 (257, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
106 (264, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
107 (265, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
108 (266, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
109 (268, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
110 (1, 'print'), |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
111 (35, '>>'), |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
112 (290, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
113 (291, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
114 (292, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
115 (293, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
116 (295, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
117 (296, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
118 (297, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
119 (298, (299, (300, (301, (302, (303, (1, 'fp')))))))))))))), |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
120 (12, ','))), |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
121 (4, ''))), |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
122 (0, '')) |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
123 |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
124 check_bad_tree(tree, "print >>fp,") |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
125 |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
126 # a,,c |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
127 tree = \ |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
128 (258, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
129 (311, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
130 (290, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
131 (291, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
132 (292, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
133 (293, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
134 (295, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
135 (296, (297, (298, (299, (300, (301, (302, (303, (1, 'a')))))))))))))), |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
136 (12, ','), |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
137 (12, ','), |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
138 (290, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
139 (291, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
140 (292, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
141 (293, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
142 (295, |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
143 (296, (297, (298, (299, (300, (301, (302, (303, (1, 'c'))))))))))))))), |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
144 (4, ''), |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
145 (0, '')) |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
146 |
|
87b8f0ea50e8
Add a minimal test suite for the parser module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
147 check_bad_tree(tree, "a,,c") |
|
14214
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
148 |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
149 # a $= b |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
150 tree = \ |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
151 (257, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
152 (264, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
153 (265, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
154 (266, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
155 (267, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
156 (312, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
157 (291, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
158 (292, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
159 (293, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
160 (294, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
161 (296, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
162 (297, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
163 (298, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
164 (299, (300, (301, (302, (303, (304, (1, 'a'))))))))))))))), |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
165 (268, (37, '$=')), |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
166 (312, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
167 (291, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
168 (292, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
169 (293, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
170 (294, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
171 (296, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
172 (297, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
173 (298, |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
174 (299, (300, (301, (302, (303, (304, (1, 'b'))))))))))))))))), |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
175 (4, ''))), |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
176 (0, '')) |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
177 |
|
b5fb175ad528
Update the parser module to support augmented assignment.
Fred Drake <fdrake@acm.org>
parents:
14111
diff
changeset
|
178 check_bad_tree(tree, "a $= b") |
