You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix pytest.approx mapping details for non-numeric values
ApproxMapping._repr_compare guards its diff arithmetic with
`except ZeroDivisionError`, so an unequal pair of non-numeric values
under the same key raises TypeError into the assertion-repr hook and the
mismatch table is replaced by "representation of details failed". The
sequence path already handles this.
Catching TypeError alone is not enough here. decimal.FloatOperation
subclasses it, and #15006 made the sequence path re-raise that ahead of
the non-number handler so a mapping mixing Decimals with floats cannot
report the smaller of two differences as the maximum. Mirror both
clauses rather than only the second.
Adds the mapping counterpart of
test_mixed_decimal_and_float_sequence_does_not_hide_float_operation,
which fails without the re-raise, so the wrong maximum is now caught by
the suite.
Closes#15009
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0 commit comments