gh-116100: Add test arg to ast.If and op arg to ast.BoolOp calls (#116101)

This commit is contained in:
Kirill Podoprigora 2024-02-29 16:59:24 +02:00 committed by GitHub
parent bea2795be2
commit 6a86030bc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -527,11 +527,11 @@ class TestSpecifics(unittest.TestCase):
self.assertRaises(TypeError, compile, co1, '<ast>', 'eval')
# raise exception when node type is no start node
self.assertRaises(TypeError, compile, _ast.If(), '<ast>', 'exec')
self.assertRaises(TypeError, compile, _ast.If(test=_ast.Name(id='x', ctx=_ast.Load())), '<ast>', 'exec')
# raise exception when node has invalid children
ast = _ast.Module()
ast.body = [_ast.BoolOp()]
ast.body = [_ast.BoolOp(op=_ast.Or())]
self.assertRaises(TypeError, compile, ast, '<ast>', 'exec')
def test_compile_invalid_typealias(self):