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

test for patch #543865 & others #36434

Closed
hfoffani mannequin opened this issue Apr 14, 2002 · 21 comments
Closed

test for patch #543865 & others #36434

hfoffani mannequin opened this issue Apr 14, 2002 · 21 comments
Assignees
Labels
tests Tests in the Lib/test dir

Comments

@hfoffani
Copy link
Mannequin

hfoffani mannequin commented Apr 14, 2002

BPO 543867
Nosy @gvanrossum, @tim-one, @doerwalter, @brettcannon, @rhettinger
Files
  • test_complex_future.py: test_complex_future.py
  • test_complex.py.diff3: cvs diff -c test_complex.py
  • diff3.txt
  • test_complex_future.py: Revised complex future test in unittest format
  • diff4.txt: merge test_complex_future into test_complex
  • 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 = 'https://github.com/doerwalter'
    closed_at = <Date 2003-08-05.16:01:59.000>
    created_at = <Date 2002-04-14.22:18:13.000>
    labels = ['tests']
    title = 'test for patch python/issues-test-cpython#543865 & others'
    updated_at = <Date 2003-08-05.16:01:59.000>
    user = 'https://bugs.python.org/hfoffani'

    bugs.python.org fields:

    activity = <Date 2003-08-05.16:01:59.000>
    actor = 'doerwalter'
    assignee = 'doerwalter'
    closed = True
    closed_date = None
    closer = None
    components = ['Tests']
    creation = <Date 2002-04-14.22:18:13.000>
    creator = 'hfoffani'
    dependencies = []
    files = ['4151', '4152', '4153', '4154', '4155']
    hgrepos = []
    issue_num = 543867
    keywords = ['patch']
    message_count = 21.0
    messages = ['39575', '39576', '39577', '39578', '39579', '39580', '39581', '39582', '39583', '39584', '39585', '39586', '39587', '39588', '39589', '39590', '39591', '39592', '39593', '39594', '39595']
    nosy_count = 6.0
    nosy_names = ['gvanrossum', 'tim.peters', 'doerwalter', 'brett.cannon', 'rhettinger', 'hfoffani']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue543867'
    versions = ['Python 2.4']

    @hfoffani
    Copy link
    Mannequin Author

    hfoffani mannequin commented Apr 14, 2002

    Here are 3 patches for:

    • test_complex.py:
      . add several checks to force execution of
      unvisited
      parts of complexobject.c code.
      . add a test for complex floor division corresponding
      bug bpo-543387 and fix bpo-543865

    • test_complex_future.py
      . add test for "future" true division.
      (actually this is not a patch but the hole file)

    • test_b1.py
      . add test for bug bpo-543840 and it's fix at patch
      bpo-543865

    Regards,
    -Hernan

    @hfoffani hfoffani mannequin closed this as completed Apr 14, 2002
    @hfoffani hfoffani mannequin assigned doerwalter Apr 14, 2002
    @hfoffani hfoffani mannequin added the tests Tests in the Lib/test dir label Apr 14, 2002
    @hfoffani hfoffani mannequin closed this as completed Apr 14, 2002
    @hfoffani hfoffani mannequin assigned doerwalter Apr 14, 2002
    @hfoffani hfoffani mannequin added the tests Tests in the Lib/test dir label Apr 14, 2002
    @hfoffani
    Copy link
    Mannequin Author

    hfoffani mannequin commented Apr 14, 2002

    Logged In: YES
    user_id=112690

    @hfoffani
    Copy link
    Mannequin Author

    hfoffani mannequin commented Apr 14, 2002

    Logged In: YES
    user_id=112690

    Following Tim's advise to group together bug/fix/test, I'll
    leave this patch entry for improvements in the tests of
    complex numbers.

    Then the valid files are:
    21173: test_complex_future.py
    and
    21180: test_complex.diff3

    @gvanrossum
    Copy link
    Member

    Logged In: YES
    user_id=6380

    I don't understand your comment. Are you withdrawing the
    files test_complex.py and test_b1.py? Have you uploaded
    these to separate patch issues? You should be able to delete
    them as the original submitter; ifthis doesn't work, let me
    know and I'll do it.

    @hfoffani
    Copy link
    Mannequin Author

    hfoffani mannequin commented Apr 22, 2002

    Logged In: YES
    user_id=112690

    Yes to both questions. I'm withdrawing test_complex.py
    and test_b1.py.
    I can't delete them and I double checked that I were
    correctly logged in as hfoffani.
    SourceForge error:
    File Delete: ArtifactFile: Permission Denied

    @gvanrossum
    Copy link
    Member

    Logged In: YES
    user_id=6380

    OK, I've deleted them for you. Who do you expect to review
    this?

    @tim-one
    Copy link
    Member

    tim-one commented Apr 22, 2002

    Logged In: YES
    user_id=31435

    I'm not sure what lines like

    vereq(a ** 105, a ** 105)
    vereq(b ** -105, b ** -105)
    vereq(b ** -30, b ** -30)

    are trying to test. That we get the same answer when we do
    exactly the same thing twice?

    Note that complex % has been deprecated: no point adding a
    test for a deprecated feature.

    The error msg for complex pow says "remainder"; it
    shouldn't.

    @hfoffani
    Copy link
    Mannequin Author

    hfoffani mannequin commented Apr 22, 2002

    Logged In: YES
    user_id=112690

    On:
    vereq(a ** 105, a ** 105) ... etc ...
    The c code in complexobject.c has special cases when the
    exponent is > 100, < than -100, and in-between.
    I didn't want to test for equality with constants to avoid
    messing up with floating point issues.

    @hfoffani
    Copy link
    Mannequin Author

    hfoffani mannequin commented Apr 22, 2002

    Logged In: YES
    user_id=112690

    Regarding "the error msg for complex pow says "remainder";
    it shouldn't" you are correct, the exception string has a
    bad wording.

    @brettcannon
    Copy link
    Member

    Logged In: YES
    user_id=357491

    The patch is now severely outdated since test_complex.py has
    been converted to PyUnit, but it might be pertinent to go through
    the patch and see if any tests are there that could be added.

    @rhettinger
    Copy link
    Contributor

    Logged In: YES
    user_id=80475

    Walter, do you care to add these in unittest form?

    Also, since the tests are to validate bug fixes, they are
    appropriate to go into Py2.3.

    @doerwalter
    Copy link
    Contributor

    Logged In: YES
    user_id=89016

    OK, I'll see if I can look at the patches later today.

    @doerwalter
    Copy link
    Contributor

    Logged In: YES
    user_id=89016

    Reworking test_complex.py.diff3 into the attached diff3.txt
    I don't see any increase in code coverage for
    complexobject.c (it stays at 91.84%) except for the file
    writing test which brings the coverage up to 92.95%. The
    current tests in test_complex.py seem to cover most test
    cases from test_complex.py.diff3 (except that
    test_complex.py.diff3 uses ** and % and the current
    test_complex.py uses pow and __mod__). So I'd say we add the
    file writing test and drop the rest.

    I'll look at test_complex_future.py tomorrow.

    @rhettinger
    Copy link
    Contributor

    Logged In: YES
    user_id=80475

    diff3.txt looks good and runs fine on my machine. I'm
    surprised that it did not increase code coverage. The
    comparisons of a ** 105 to itself should be commented as a
    whitebox test of a special case code path.

    @rhettinger
    Copy link
    Contributor

    Logged In: YES
    user_id=80475

    Converted test_complex_future.py to unittest format. See
    attachment.

    @doerwalter
    Copy link
    Contributor

    Logged In: YES
    user_id=89016

    test_complex.py is checked in as rev 1.12.

    test_complex_future.py looks good, although I don't exactly
    understand its purpose, as there are tests from true
    division and floor division in test_complex.py already. We
    could extend check_div() in test_complex.py to try both
    __truediv__ and __floordiv__. This would IMHO be better than
    the code duplication in test_complex_future.py

    @rhettinger
    Copy link
    Contributor

    Logged In: YES
    user_id=80475

    That's a much better plan.

    @doerwalter
    Copy link
    Contributor

    Logged In: YES
    user_id=89016

    OK here is a patch (diff4.txt) that merges
    test_complex_future.py into test_complex.py.

    @rhettinger
    Copy link
    Contributor

    Logged In: YES
    user_id=80475

    Since __floordiv__ is deprecated for complex, it should be
    left out of the test. Otherwise, it is ready to load.

    Because they've already tagged the Py2.3 release candidate,
    am marking this as a Py2.4 addition.

    @hfoffani
    Copy link
    Mannequin Author

    hfoffani mannequin commented Jul 18, 2003

    Logged In: YES
    user_id=112690

    thank you guys, for taking up these.
    sadly, i don't have linux available anymore.
    i must tell you that the patch was the result of a self-
    excercise to learn about CPython. don't be surprise if you
    don't see mayor improvements in code coverage percentages.
    at the time I was very happy if I saw just 1 new LOC on a
    branch tested: it meant that I understood Python's internals
    involved.
    sorry for the trouble.
    regards,
    -hernan

    @doerwalter
    Copy link
    Contributor

    Logged In: YES
    user_id=89016

    Checked in as:
    Lib/test/test_complex.py 1.13+1.14
    and
    Lib/test/test_complex.py 1.12.6.1

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 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
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants