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

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

Issue 11682: PEP 380 reference implementation for 3.3
Patch Set: Created 8 years, 2 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 # Python test set -- part 1, grammar. 1 # Python test set -- part 1, grammar.
2 # This just tests whether the parser accepts them all. 2 # This just tests whether the parser accepts them all.
3 3
4 from test.support import run_unittest, check_syntax_error 4 from test.support import run_unittest, check_syntax_error
5 import unittest 5 import unittest
6 import sys 6 import sys
7 # testing import * 7 # testing import *
8 from sys import * 8 from sys import *
9 9
10 10
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 def test_return(self): 452 def test_return(self):
453 # 'return' [testlist] 453 # 'return' [testlist]
454 def g1(): return 454 def g1(): return
455 def g2(): return 1 455 def g2(): return 1
456 g1() 456 g1()
457 x = g2() 457 x = g2()
458 check_syntax_error(self, "class foo:return 1") 458 check_syntax_error(self, "class foo:return 1")
459 459
460 def test_yield(self): 460 def test_yield(self):
461 check_syntax_error(self, "class foo:yield 1") 461 check_syntax_error(self, "class foo:yield 1")
462 check_syntax_error(self, "yield from")
462 463
463 def test_raise(self): 464 def test_raise(self):
464 # 'raise' test [',' test] 465 # 'raise' test [',' test]
465 try: raise RuntimeError('just testing') 466 try: raise RuntimeError('just testing')
466 except RuntimeError: pass 467 except RuntimeError: pass
467 try: raise KeyboardInterrupt 468 try: raise KeyboardInterrupt
468 except KeyboardInterrupt: pass 469 except KeyboardInterrupt: pass
469 470
470 def test_import(self): 471 def test_import(self):
471 # 'import' dotted_as_names 472 # 'import' dotted_as_names
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 self.assertTrue(False is (2 is 3)) 924 self.assertTrue(False is (2 is 3))
924 self.assertFalse((False is 2) is 3) 925 self.assertFalse((False is 2) is 3)
925 self.assertFalse(False is 2 is 3) 926 self.assertFalse(False is 2 is 3)
926 927
927 928
928 def test_main(): 929 def test_main():
929 run_unittest(TokenTests, GrammarTests) 930 run_unittest(TokenTests, GrammarTests)
930 931
931 if __name__ == '__main__': 932 if __name__ == '__main__':
932 test_main() 933 test_main()
OLDNEW

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