-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
bpo-19119: Remove invalid test and rename a misnamed test #15442
Conversation
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.
Did you determine that the suggested changes in the patch by roippi to the GetOnly
class and first test_get_only
method were invalid? From what I can tell, their intention was to modify the GetOnly
class, modify the first test_get_only
method, and rename the second one, whereas this PR is removing the GetOnly
class, removing the first test_get_only
method, and renaming the second one.
This is what GetOnly
would look like after the changes suggested in the patch:
class GetOnly:
"Dummy sequence class defining __getitem__ but not __len__."
def __getitem__(self, ndx):
if ndx > 10:
raise IndexError
return 10
This is what the first test_get_only
would look like after the changes suggested in the patch:
def test_get_only(self):
for f in (self.module.heapify, self.module.heappop):
self.assertRaises((TypeError, AttributeError), f, GetOnly())
for f in (self.module.heappush, self.module.heapreplace):
self.assertRaises((TypeError, AttributeError), f, GetOnly(), 10)
for f in (self.module.nlargest, self.module.nsmallest):
self.assertEqual(f(2, GetOnly()), [10,10])
I'm not arguing against the removal of the GetOnly
class and the first test_get_only
method, I'm just trying to understand the reasoning for doing so.
The issue with the proposed test revision is that it doesn't really test anything we care about regarding heaps. The original test was just a cut-and-paste error from another test source. It doesn't actually help with testing heaps. Thanks for taking a look at this. |
No problem, thanks for the clarification. (: |
Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
GH-15447 is a backport of this pull request to the 3.8 branch. |
https://bugs.python.org/issue19119