polars.testing.assert_series_equal has incorrect logic for infinities #16859
Labels
bug
Something isn't working
needs triage
Awaiting prioritization by a maintainer
python
Related to Python Polars
Checks
Reproducible example
Log output
No response
Issue description
When the
right
vector is infinity (andcheck_exact=False
), thepolars.testing.assert_series_equal(left, right)
function is buggy.This occurs because this function (inside
polars/testing/asserts/series.py
) usesexceeds_tolerance = difference > tolerance
and in our case, bothdifference
andtolerance
are infinity.It is arguably more correct to use
exceeds_tolerance = difference >= tolerance
, but of course that is not strictly backwards-compatible.(I cannot use
check_exact=True
because in my actual use case, I have non-infinity values and I really do wantcheck_exact=False
for finite values.)Expected behavior
The assertion should fail.
Installed versions
The text was updated successfully, but these errors were encountered: