Skip to content

Conversation

@sobolevn
Copy link
Member

@sobolevn sobolevn commented Sep 27, 2023

I've also added PointFromInheritance, since it is a very common pattern.

y: int = 0
for Point in (PointFromCall, PointFromInheritance, PointFromClass):
with self.subTest(Point=Point):
p = Point(11, 22)
Copy link
Member

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?

Suggested change
p = Point(11, 22)
p = Point(11, 22)
assert isinstance(copy.replace(p, x=12), Point)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? :)
Done.

Copy link
Member

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!

Copy link
Member

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.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a 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.

@serhiy-storchaka serhiy-storchaka merged commit bb2e96f into python:main Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants