Skip to content

Refactor tests for better error messages#494

Merged
j-adamczyk merged 8 commits intomasterfrom
better_test_messages
Sep 25, 2025
Merged

Refactor tests for better error messages#494
j-adamczyk merged 8 commits intomasterfrom
better_test_messages

Conversation

@j-adamczyk
Copy link
Copy Markdown
Member

Changes

Refactoring of tests to use np.testing.array_equal primarily to compare values. It very nicely prints the actual and expected values, in comparison to raw assert.

Previous:

>       assert np.array_equal(X_skfp + 1, X_rdkit)
E       AssertionError

tests/fingerprints/atom_pair.py:20: AssertionError

Current:

>       assert_equal(X_skfp + 1, X_rdkit)
E       AssertionError: 
E       Arrays are not equal
E       
E       Mismatched elements: 204800 / 204800 (100%)
E       Max absolute difference among violations: 1
E       Max relative difference among violations: 1.
E        ACTUAL: array([[1, 1, 1, ..., 1, 1, 1],
E              [2, 2, 2, ..., 1, 1, 1],
E              [1, 1, 1, ..., 1, 1, 1],...
E        DESIRED: array([[0, 0, 0, ..., 0, 0, 0],
E              [1, 1, 1, ..., 0, 0, 0],
E              [0, 0, 0, ..., 0, 0, 0],...

Checklist before requesting a review

  • Docstrings added/updated in public functions and classes
  • Tests added, reasonable test coverage (at least ~90%, make test-coverage)
  • Sphinx docs added/updated and render properly (make docs and see docs/_build/index.html)

mjste
mjste previously approved these changes Sep 24, 2025
mjste
mjste previously approved these changes Sep 24, 2025
@j-adamczyk j-adamczyk requested a review from mjste September 25, 2025 07:51
@j-adamczyk j-adamczyk merged commit b7eb38d into master Sep 25, 2025
13 checks passed
@j-adamczyk j-adamczyk deleted the better_test_messages branch September 25, 2025 11:01
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.

3 participants