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

Assert statements in shape_generator_test.py trivially evaluate as True #141

Open
jwuphysics opened this issue Sep 17, 2024 · 0 comments
Open
Labels
bug Something isn't working tests

Comments

@jwuphysics
Copy link

Describe the bug
Several coverage tests throw a warning from poetry because they always evaluate to True. This happens because non-empty tuples always evaluate as True, and the assert statement does not take parentheses (it is a keyword, not a function, in Python). Here is a list of assertions that always evaluate to True:

tests/shape_generator_test.py:286
  /Users/john/research/scratch/DeepBench/tests/shape_generator_test.py:286: PytestAssertRewriteWarning: assertion is always true, perhaps remove parentheses?
    assert (1.0 == line[1, 2], "line start incorrect")

tests/shape_generator_test.py:287
  /Users/john/research/scratch/DeepBench/tests/shape_generator_test.py:287: PytestAssertRewriteWarning: assertion is always true, perhaps remove parentheses?
    assert (1.0 == line[26, 27], "line end incorrect")

tests/shape_generator_test.py:289
  /Users/john/research/scratch/DeepBench/tests/shape_generator_test.py:289: PytestAssertRewriteWarning: assertion is always true, perhaps remove parentheses?
    assert (0.0 == line[1, 27], "line corner incorrect")

tests/shape_generator_test.py:290
  /Users/john/research/scratch/DeepBench/tests/shape_generator_test.py:290: PytestAssertRewriteWarning: assertion is always true, perhaps remove parentheses?
    assert (0.0 == line[27, 1], "line corner incorrect")

tests/shape_generator_test.py:264
  /Users/john/research/scratch/DeepBench/tests/shape_generator_test.py:264: PytestAssertRewriteWarning: assertion is always true, perhaps remove parentheses?
    assert (arc_rotated.all(), arc_non_rotated.all())

tests/shape_generator_test.py:256
  /Users/john/research/scratch/DeepBench/tests/shape_generator_test.py:256: PytestAssertRewriteWarning: assertion is always true, perhaps remove parentheses?
    assert (arc_rotated.all(), arc_non_rotated.all())

tests/shape_generator_test.py:226
  /Users/john/research/scratch/DeepBench/tests/shape_generator_test.py:226: PytestAssertRewriteWarning: assertion is always true, perhaps remove parentheses?
    assert (x, expected_x)

tests/shape_generator_test.py:227
  /Users/john/research/scratch/DeepBench/tests/shape_generator_test.py:227: PytestAssertRewriteWarning: assertion is always true, perhaps remove parentheses?
    assert (y, expected_y)

tests/shape_generator_test.py:213
  /Users/john/research/scratch/DeepBench/tests/shape_generator_test.py:213: PytestAssertRewriteWarning: assertion is always true, perhaps remove parentheses?
    assert (triangle_rotated.all(), triangle_non_rotated.all())

tests/shape_generator_test.py:205
  /Users/john/research/scratch/DeepBench/tests/shape_generator_test.py:205: PytestAssertRewriteWarning: assertion is always true, perhaps remove parentheses?
    assert (triangle_rotated.all(), triangle_non_rotated.all())

To Reproduce
I ran the tests using poetry, i.e. poetry run pytest --cov.

Expected behavior
I would expect these assert statements to evaluate True in a non-trivial manner.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS 14.6.1
  • Python version: 3.10.14
  • Version 0.2.3 (installed via poetry)

Additional context
There are also two warnings associated with the test_resize_zero_size_source test, but since that should throw a ValueError, I'm not too worried here...

@voetberg voetberg added bug Something isn't working tests labels Sep 23, 2024
voetberg added a commit to voetberg/DeepBench that referenced this issue Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tests
Projects
None yet
Development

No branches or pull requests

2 participants