You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
withself.assertRaisesRegex(ValueError, 'unexpected field name'):
copy.replace(p, x=1, error=2)
@serhiy-storchaka noted in #108752 (comment) that only named tuples created by collections.namedtuple() are supported. But, since typing.NamedTuple uses collections.namedtuple inside:
"Named tuple" is more general term (https://docs.python.org/3/glossary.html#term-named-tuple). Not all named tuples in wide meaning are supported (for example named tuples created by the PyStructSequence C API are not supported yet). typing.NamedTyple is a funny way to call collections.namedtuple(), so this note covers it too. If you want to test them, would not be better to add new tests to other typing.NamedTyple tests?
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Right now only
collections.namedtuple
is tested:cpython/Lib/test/test_copy.py
Lines 937 to 946 in b1aebf1
@serhiy-storchaka noted in #108752 (comment) that only named tuples created by
collections.namedtuple()
are supported. But, sincetyping.NamedTuple
usescollections.namedtuple
inside:cpython/Lib/typing.py
Lines 2695 to 2696 in b1aebf1
I have a PR ready with extra tests.
Refs #108751
Refs #108752
Linked PRs
typing.NamedTuple
withcopy.replace
#109957The text was updated successfully, but these errors were encountered: