mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Issue #14965: Bring Tools/parser/unparse.py up to date with the Python 3.3. Grammar.
This commit is contained in:
		
						commit
						fe8440aec0
					
				
					 3 changed files with 60 additions and 19 deletions
				
			
		|  | @ -93,6 +93,21 @@ class Foo: pass | |||
|     suite5 | ||||
| """ | ||||
| 
 | ||||
| with_simple = """\ | ||||
| with f(): | ||||
|     suite1 | ||||
| """ | ||||
| 
 | ||||
| with_as = """\ | ||||
| with f() as x: | ||||
|     suite1 | ||||
| """ | ||||
| 
 | ||||
| with_two_items = """\ | ||||
| with f() as x, g() as y: | ||||
|     suite1 | ||||
| """ | ||||
| 
 | ||||
| class ASTTestCase(unittest.TestCase): | ||||
|     def assertASTEqual(self, ast1, ast2): | ||||
|         self.assertEqual(ast.dump(ast1), ast.dump(ast2)) | ||||
|  | @ -209,6 +224,22 @@ def test_elifs(self): | |||
|     def test_try_except_finally(self): | ||||
|         self.check_roundtrip(try_except_finally) | ||||
| 
 | ||||
|     def test_starred_assignment(self): | ||||
|         self.check_roundtrip("a, *b, c = seq") | ||||
|         self.check_roundtrip("a, (*b, c) = seq") | ||||
|         self.check_roundtrip("a, *b[0], c = seq") | ||||
|         self.check_roundtrip("a, *(b, c) = seq") | ||||
| 
 | ||||
|     def test_with_simple(self): | ||||
|         self.check_roundtrip(with_simple) | ||||
| 
 | ||||
|     def test_with_as(self): | ||||
|         self.check_roundtrip(with_as) | ||||
| 
 | ||||
|     def test_with_two_items(self): | ||||
|         self.check_roundtrip(with_two_items) | ||||
| 
 | ||||
| 
 | ||||
| class DirectoryTestCase(ASTTestCase): | ||||
|     """Test roundtrip behaviour on all files in Lib and Lib/test.""" | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Mark Dickinson
						Mark Dickinson