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

Wrong behavior of test_eq comparing sequences with trailing Nones #519

Open
civvic opened this issue Mar 3, 2023 · 0 comments
Open

Wrong behavior of test_eq comparing sequences with trailing Nones #519

civvic opened this issue Mar 3, 2023 · 0 comments

Comments

@civvic
Copy link

civvic commented Mar 3, 2023

Is this intended?:

python -i
Python 3.11.0 | packaged by conda-forge | (main, Jan 15 2023, 05:44:48) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from fastcore.test import *
>>> test_eq((13, ), (13, None, ))
>>> test_eq([13, ], [13, None, ])
>>> test_eq([13, 14, ], [13, 14, None, ])
>>> test_eq((13, None, ), (13, ))

Above lines run without problems. My understanding is that any should raise an AssertionError, like, e.g., this below:

>>> test_eq((13, ), (None, 13, ))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/vic/dev/repo/project/sonofcr/proj/socr-server/.micromamba/envs/sonofcr/lib/python3.11/site-packages/fastcore/test.py", line 37, in test_eq
    test(a,b,equals, cname='==')
  File "/Users/vic/dev/repo/project/sonofcr/proj/socr-server/.micromamba/envs/sonofcr/lib/python3.11/site-packages/fastcore/test.py", line 27, in test
    assert cmp(a,b),f"{cname}:\n{a}\n{b}"
AssertionError: ==:
(13,)
(None, 13)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant