mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
gh-110275: Named tuple's __replace__() now raises TypeError for invalid arguments (GH-110299)
This commit is contained in:
parent
da6760bdf5
commit
c74e9fb189
5 changed files with 9 additions and 7 deletions
|
|
@ -488,12 +488,8 @@ class TestNamedTuple(unittest.TestCase):
|
|||
self.assertEqual(p._replace(x=1), (1, 22)) # test _replace method
|
||||
self.assertEqual(p._asdict(), dict(x=11, y=22)) # test _asdict method
|
||||
|
||||
try:
|
||||
with self.assertRaises(TypeError):
|
||||
p._replace(x=1, error=2)
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
self._fail('Did not detect an incorrect fieldname')
|
||||
|
||||
# verify that field string can have commas
|
||||
Point = namedtuple('Point', 'x, y')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue