Conversation
… a different ABC class
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
Lib/test/test_typing.py
Outdated
| def test_subclassing_subclasshook(self): | ||
|
|
||
| class Base(typing.Iterable): | ||
| class Base(abc.ABC): |
There was a problem hiding this comment.
I think you've misunderstood the intent of this test, I'm afraid.
If the intent of this test was to check that custom __subclasshook__ methods worked on subclasses of abc.ABC, then this test would be in test_abc.py, not test_typing.py. I believe the intent of this test is to check that subclasses of typing.Iterable (and other collections.abc aliases in typing.py) can define custom __subclasshook__ methods in the same way as the "original" classes in collections.abc, despite the fact that typing.Iterable isn't actually a class in the same way that collections.abc.Iterable is:
>>> import typing
>>> type(typing.Iterable)
<class 'typing._SpecialGenericAlias'>So, far from clarifying the intent of this test, I'm afraid this change turns it from being a useful test into a somewhat useless test.
There was a problem hiding this comment.
Also note that this test is found in a class called CollectionsAbcTests. It would be strange to have a test found in this class that didn't pertain specifically to an alias for a class from collections.abc.
There was a problem hiding this comment.
Thanks for clarifying @AlexWaygood, I've reverted that particular change.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
|
The remaining change is purely cosmetic. I'm afraid CPython's policy is generally to reject PRs that make purely cosmetic changes, as they just lead to code churn, obscuring git history. Sorry to be a grouch this close to Christmas, but I think I'll close this PR, since it isn't solving an actual problem of any kind, as far as I can see :/ I hope this doesn't discourage you too much from contributing to CPython in the future! We have lots of open issues that need fixing, and 211 are currently marked with the |
Changes:
Makes(Edit: this was a misunderstanding on my part).Baseinherit fromabc.ABCinstead oftyping.Iterable, which is a clearer statement of intent.Not creating an issue as I don't think this warrants one.
Not creating a News entry as I don't think this warrants one.