Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(62817)

Side by Side Diff: Lib/test/test_parser.py

Issue 11682: PEP 380 reference implementation for 3.3
Patch Set: Created 8 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 import parser 1 import parser
2 import unittest 2 import unittest
3 import sys 3 import sys
4 import operator 4 import operator
5 from test import support 5 from test import support
6 6
7 # 7 #
8 # First, we test that we can generate trees from valid source fragments, 8 # First, we test that we can generate trees from valid source fragments,
9 # and that these valid trees are indeed allowed by the tree-loading side 9 # and that these valid trees are indeed allowed by the tree-loading side
10 # of the parser module. 10 # of the parser module.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 self.check_suite("def f(): yield") 43 self.check_suite("def f(): yield")
44 self.check_suite("def f(): x += yield") 44 self.check_suite("def f(): x += yield")
45 self.check_suite("def f(): x = yield 1") 45 self.check_suite("def f(): x = yield 1")
46 self.check_suite("def f(): x = y = yield 1") 46 self.check_suite("def f(): x = y = yield 1")
47 self.check_suite("def f(): x = yield") 47 self.check_suite("def f(): x = yield")
48 self.check_suite("def f(): x = y = yield") 48 self.check_suite("def f(): x = y = yield")
49 self.check_suite("def f(): 1 + (yield)*2") 49 self.check_suite("def f(): 1 + (yield)*2")
50 self.check_suite("def f(): (yield 1)*2") 50 self.check_suite("def f(): (yield 1)*2")
51 self.check_suite("def f(): return; yield 1") 51 self.check_suite("def f(): return; yield 1")
52 self.check_suite("def f(): yield 1; return") 52 self.check_suite("def f(): yield 1; return")
53 self.check_suite("def f(): yield from 1")
54 self.check_suite("def f(): x = yield from 1")
55 self.check_suite("def f(): f(yield from 1)")
56 self.check_suite("def f(): yield 1; return 1")
53 self.check_suite("def f():\n" 57 self.check_suite("def f():\n"
54 " for x in range(30):\n" 58 " for x in range(30):\n"
55 " yield x\n") 59 " yield x\n")
56 self.check_suite("def f():\n" 60 self.check_suite("def f():\n"
57 " if (yield):\n" 61 " if (yield):\n"
58 " yield x\n") 62 " yield x\n")
59 63
60 def test_expressions(self): 64 def test_expressions(self):
61 self.check_expr("foo(1)") 65 self.check_expr("foo(1)")
62 self.check_expr("[1, 2, 3]") 66 self.check_expr("[1, 2, 3]")
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 IllegalSyntaxTestCase, 632 IllegalSyntaxTestCase,
629 CompileTestCase, 633 CompileTestCase,
630 ParserStackLimitTestCase, 634 ParserStackLimitTestCase,
631 STObjectTestCase, 635 STObjectTestCase,
632 OtherParserCase, 636 OtherParserCase,
633 ) 637 )
634 638
635 639
636 if __name__ == "__main__": 640 if __name__ == "__main__":
637 test_main() 641 test_main()
OLDNEW

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+