gh-116030: test_unparse: Add `ctx argument to ast.Name` calls (#116031)

This commit is contained in:
Kirill Podoprigora 2024-02-28 13:04:23 +02:00 committed by GitHub
parent 1752b51012
commit 3b63d0769f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -370,13 +370,13 @@ def test_slices(self):
self.check_ast_roundtrip("a[i:j, k]")
def test_invalid_raise(self):
self.check_invalid(ast.Raise(exc=None, cause=ast.Name(id="X")))
self.check_invalid(ast.Raise(exc=None, cause=ast.Name(id="X", ctx=ast.Load())))
def test_invalid_fstring_value(self):
self.check_invalid(
ast.JoinedStr(
values=[
ast.Name(id="test"),
ast.Name(id="test", ctx=ast.Load()),
ast.Constant(value="test")
]
)
@ -718,7 +718,7 @@ def test_function_with_type_params_and_bound(self):
body=[ast.Pass()],
decorator_list=[],
returns=None,
type_params=[ast.TypeVar("T", bound=ast.Name("int"))],
type_params=[ast.TypeVar("T", bound=ast.Name("int", ctx=ast.Load()))],
)
ast.fix_missing_locations(node)
self.assertEqual(ast.unparse(node), "def f[T: int]():\n pass")