Skip to content
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

Merged
merged 2 commits into from
Aug 24, 2019

Conversation

rhettinger
Copy link
Contributor

@rhettinger rhettinger commented Aug 24, 2019

Copy link
Contributor

@aeros aeros left a comment

Choose a reason for hiding this comment

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

@rhettinger

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.

@rhettinger
Copy link
Contributor Author

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.

@aeros
Copy link
Contributor

aeros commented Aug 24, 2019

Thanks for taking a look at this.

No problem, thanks for the clarification. (:

@rhettinger rhettinger merged commit 4101181 into python:master Aug 24, 2019
@rhettinger rhettinger deleted the heapq_dup_test branch August 24, 2019 05:31
@miss-islington
Copy link
Contributor

Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-15447 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 24, 2019
…5442)

(cherry picked from commit 4101181)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.8 only security fixes label Aug 24, 2019
rhettinger added a commit that referenced this pull request Aug 24, 2019
…H-15447)

(cherry picked from commit 4101181)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
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.

5 participants