Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Apply suggestions from code review
Co-authored-by: Victor Stinner <[email protected]>
  • Loading branch information
JelleZijlstra and vstinner authored Jan 24, 2026
commit ae7668b2fd9e3fd7ccb8bb0ec75a6fea4e577a69
6 changes: 4 additions & 2 deletions Lib/test/test_ast/test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,8 @@ def test_replace_reject_unknown_instance_fields(self):

def test_replace_non_str_kwarg(self):
node = ast.Name(id="x")
with self.assertRaisesRegex(TypeError, "got an unexpected keyword argument <object object"):
errmsg = "got an unexpected keyword argument <object object"
with self.assertRaisesRegex(TypeError, errmsg):
node.__replace__(**{object(): "y"})


Expand Down Expand Up @@ -3311,9 +3312,10 @@ class _AllFieldTypes(ast.AST):
self.assertEqual(obj.b, [])

def test_non_str_kwarg(self):
warn_msg = "got an unexpected keyword argument <object object"
with (
self.assertRaises(TypeError),
self.assertWarnsRegex(DeprecationWarning, "got an unexpected keyword argument <object object"),
self.assertWarnsRegex(DeprecationWarning, warn_msg),
):
Comment thread
JelleZijlstra marked this conversation as resolved.
ast.Name(**{object(): 'y'})

Expand Down
Loading