Repository navigation
Conversation
A zero timedelta does not compare equal to numeric zero. Include it in the relative-difference guards so failing duration sequences keep their mismatch table and mappings report an infinite relative difference.
muneikh
marked this pull request as ready for review
October 11, 2026 14:34
This comment was marked as low quality.
This comment was marked as low quality.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Keep approx failure details for zero timedeltas
When an obtained duration in a sequence is zero, a failing approx assertion
loses its mismatch table because the relative-difference calculation divides
by timedelta(0). In mappings, an expected zero duration is skipped in that
calculation, which can understate the maximum relative difference.
The existing numeric zero guards now recognize timedelta(0) too. This keeps
the duration mismatch table and reports an infinite relative difference when
its denominator is zero. The regression cases include a second finite
difference to check that it cannot replace the infinite result.
Validation: the two new regression cases fail on the original source; the
approx and assertion modules pass (388 tests). The complete Python 3.13 tox
environment passes (4,694 passed, 51 skipped, 15 xfailed, 5 xpassed). The pinned
pre-commit checks on the changed files pass, including mypy.