FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-109956: Also test `typing.NamedTuple` with `copy.replace` by sobolevn · Pull Request #109957 · python/cpython · GitHub

/ cpython Public

gh-109956: Also test typing.NamedTuple with copy.replace - #109957

Merged
serhiy-storchaka merged 3 commits into
python:mainfrom
sobolevn:issue-109956
Oct 3, 2023
Merged

gh-109956: Also test typing.NamedTuple with copy.replace#109957
serhiy-storchaka merged 3 commits into
python:mainfrom
sobolevn:issue-109956

Conversation

sobolevn commented Sep 27, 2023
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

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

Comment thread Lib/test/test_copy.py
y: int = 0
for Point in (PointFromCall, PointFromInheritance, PointFromClass):
with self.subTest(Point=Point):
p = Point(11, 22)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why not? :)
Done.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Oh I meant to test the copy, not the original p!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Comment thread Lib/test/test_copy.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL