-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-109956: Also test typing.NamedTuple
with copy.replace
#109957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
y: int = 0 | ||
for Point in (PointFromCall, PointFromInheritance, PointFromClass): | ||
with self.subTest(Point=Point): | ||
p = Point(11, 22) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we test the class?
p = Point(11, 22) | |
p = Point(11, 22) | |
assert isinstance(copy.replace(p, x=12), Point) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not? :)
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I meant to test the copy, not the original p!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not notice this conversation (I can't see the text few lines above the line I'm looking at), but I added a test for a copy just before merging. I was puzzled as to why the test for the original was added, but decided not to drag the review out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not think that such tests were necessary and that this was the right place for such tests. But I won't mind if you want to add them here.
I've also added
PointFromInheritance
, since it is a very common pattern.typing.NamedTuple
withcopy.replace
#109956