Assert statements in `shape_generator_test.py` trivially evaluate as True
Opened this issue · 0 comments
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...