Skip to content

tests: compare save/load scores directly for pytest 9.2 - #70

Merged
codelion merged 1 commit into
codelion:mainfrom
Sandeep85Das:patch-1
Nov 2, 2026
Merged

codelion merged 1 commit into
codelion:mainfrom
Sandeep85Das:patch-1

Conversation

@Sandeep85Das

Copy link
Copy Markdown
Contributor

pytest 9.2.0 (released Oct 27) rejects nested data in pytest.approx, so the weekly CI run started failing on tests/test_failure_modes.py::test_a_clean_save_loads_and_predicts_the_same:

TypeError: pytest.approx() does not support nested data structures

The test passed [(label, score)] pairs to pytest.approx, with a fallback that also passed when only the labels matched. This change compares labels and scores separately, so the test now also fails if scores change after a save and load.

Checked locally on Python 3.12 with pytest 9.2.0: the old test fails, and the new one passes on 5 seeds along with the rest of tests/test_failure_modes.py. Scores differ by about 6e-12 after a reload, well inside the test's 1e-5 tolerance, so the library itself is fine.

pytest 9.2 rejects nested data in pytest.approx, which broke this test. Compare labels and scores separately. This also checks the scores for real: the old fallback passed whenever the labels matched.
@codelion
codelion merged commit 6ac8508 into codelion:main Nov 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants