unparser: fix bug in unit test assertion (#33722)
This commit is contained in:
		 Massimiliano Culpo
					Massimiliano Culpo
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							d79cba1a77
						
					
				
				
					commit
					c0ed5612ab
				
			| @@ -178,16 +178,14 @@ async def f(): | |||||||
| """ | """ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def assertASTEqual(ast1, ast2): |  | ||||||
|     ast.dump(ast1) == ast.dump(ast2) |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| def check_ast_roundtrip(code1, filename="internal", mode="exec"): | def check_ast_roundtrip(code1, filename="internal", mode="exec"): | ||||||
|     ast1 = compile(str(code1), filename, mode, ast.PyCF_ONLY_AST) |     ast1 = compile(str(code1), filename, mode, ast.PyCF_ONLY_AST) | ||||||
|     code2 = spack.util.unparse.unparse(ast1) |     code2 = spack.util.unparse.unparse(ast1) | ||||||
| 
 | 
 | ||||||
|     ast2 = compile(code2, filename, mode, ast.PyCF_ONLY_AST) |     ast2 = compile(code2, filename, mode, ast.PyCF_ONLY_AST) | ||||||
|     assertASTEqual(ast1, ast2) | 
 | ||||||
|  |     error_msg = "Failed to roundtrip {} [mode={}]".format(filename, mode) | ||||||
|  |     assert ast.dump(ast1) == ast.dump(ast2), error_msg | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def test_core_lib_files(): | def test_core_lib_files(): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user