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

Remove empty tests in test_bytes.FixedStringTest #63786

Closed
zware opened this issue Nov 14, 2013 · 9 comments
Closed

Remove empty tests in test_bytes.FixedStringTest #63786

zware opened this issue Nov 14, 2013 · 9 comments
Labels
tests Tests in the Lib/test dir type-feature A feature request or enhancement

Comments

@zware
Copy link
Member

zware commented Nov 14, 2013

BPO 19587
Nosy @birkenfeld, @ezio-melotti, @vadmium, @zware, @serhiy-storchaka
Files
  • test_bytes.diff: Remove non-testing tests
  • test_bytes.v2.diff
  • test_bytes.v3.diff: Also remove redundant tests
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2016-02-01.11:43:10.560>
    created_at = <Date 2013-11-14.17:47:22.809>
    labels = ['type-feature', 'tests']
    title = 'Remove empty tests in test_bytes.FixedStringTest'
    updated_at = <Date 2016-02-01.11:43:10.558>
    user = 'https://github.com/zware'

    bugs.python.org fields:

    activity = <Date 2016-02-01.11:43:10.558>
    actor = 'martin.panter'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-02-01.11:43:10.560>
    closer = 'martin.panter'
    components = ['Tests']
    creation = <Date 2013-11-14.17:47:22.809>
    creator = 'zach.ware'
    dependencies = []
    files = ['32616', '32617', '41335']
    hgrepos = []
    issue_num = 19587
    keywords = ['patch']
    message_count = 9.0
    messages = ['202866', '202869', '202871', '202874', '203082', '256595', '256640', '259319', '259320']
    nosy_count = 7.0
    nosy_names = ['nnorwitz', 'georg.brandl', 'ezio.melotti', 'python-dev', 'martin.panter', 'zach.ware', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue19587'
    versions = ['Python 3.5', 'Python 3.6']

    @zware
    Copy link
    Member Author

    zware commented Nov 14, 2013

    The attached patch removes test_bytes.FixedStringTest and its subclasses, as they report success when they don't actually test anything at all.

    @zware zware added tests Tests in the Lib/test dir type-feature A feature request or enhancement labels Nov 14, 2013
    @serhiy-storchaka
    Copy link
    Member

    ByteArrayAsStringTest and BytesAsStringTest inherit tests from test.string_tests.BaseTest.

    @zware
    Copy link
    Member Author

    zware commented Nov 14, 2013

    So they do, I failed to notice that. New patch just removes the empty test methods.

    @zware zware changed the title Remove test_bytes.FixedStringTest Remove empty tests in test_bytes.FixedStringTest Nov 14, 2013
    @serhiy-storchaka
    Copy link
    Member

    This LGTM, but the purpose of suppressing these tests is not absolutely clear to me. I suppose they were suppressed in times when bytes and batearray had no the lower() and upper() methods and the __contains__() methods accepted only integers. It will be good if developers which touched this code in past will made a review.

    @ezio-melotti
    Copy link
    Member

    I said this elsewhere but I'll repeat it here.
    I think the whole string_tests could/should be reorganized (and possibly documented). There are lot of classes and mixins on several files, and more than once I found tests that were accidentally not run or had other problems. This got worse after Python 3, where bytes and strings share even less code. Reorganizing this should make things easier to follow and will probably solve issues like this. This of course is a bigger project than simply fixing these methods, so it should probably be addressed in a separate issue.

    @vadmium
    Copy link
    Member

    vadmium commented Dec 17, 2015

    test_contains() does not appear to be overriding anything, so there is no problem removing that.

    Unmasking the other three methods will allow six new test methods to run (via ByteArrayAsStringTest and BytesAsStringTest). There are already three equivalent methods defined in buffer_tests.py run via BytearrayPEP3137Test. I suggest to remove those three from buffer_tests. The net result will be the same tests run for bytes(), and three new tests for bytearray(). The buffer_tests file is not used anywhere else.

    @serhiy-storchaka
    Copy link
    Member

    Currently buffer_tests.py is used only for bytearray, and it looks that it duplicates string_tests.py. May be remove all duplicated tests and move the rest of tests (if any) just into test_bytes.py?

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 1, 2016

    New changeset 22c2dd04a3d3 by Martin Panter in branch '3.5':
    Issue bpo-19587: Remove masked and redundant tests in test_bytes
    https://hg.python.org/cpython/rev/22c2dd04a3d3

    New changeset 8545a082fcaa by Martin Panter in branch 'default':
    Issue bpo-19587: Merge test_bytes cleanup from 3.5
    https://hg.python.org/cpython/rev/8545a082fcaa

    @vadmium
    Copy link
    Member

    vadmium commented Feb 1, 2016

    Thanks Serhiy for reviewing. You are right that buffer_tests is only run on bytearray; I must have gotten mixed up. I fixed the comment in the version I committed.

    Yes I think I agree with eliminating buffer_tests.py, which is only run for bytearray. I opened bpo-26257 for that.

    @vadmium vadmium closed this as completed Feb 1, 2016
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    tests Tests in the Lib/test dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants