Repository navigation
Add tests for the array assert_eq helper - #12441
Conversation
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 25 files ± 0 25 suites ±0 7h 0m 22s ⏱️ - 8m 57s Results for commit 174bee1. ± Comparison against base commit d0666ee. ♻️ This comment has been updated with latest results. |
| assert assert_eq(d, x) | ||
| assert assert_eq(x, x) | ||
| assert assert_eq(d, d) |
There was a problem hiding this comment.
there should not be an extra assert. There should also be a false-y use case.
| @pytest.mark.skipif(bool(sys.flags.optimize), reason="Assertions disabled.") | ||
| def test_assert_eq_checks_shape(): | ||
| with pytest.raises(AssertionError): | ||
| assert_eq(np.array([1, 2]), np.array([1, 2, 3])) |
| with pytest.raises(AssertionError): | ||
| assert_eq(a, b) | ||
| # values are equal, so disabling the dtype check should pass | ||
| assert assert_eq(a, b, check_dtype=False) |
There was a problem hiding this comment.
| assert assert_eq(a, b, check_dtype=False) | |
| assert_eq(a, b, check_dtype=False) |
| a = np.array([1.0, np.nan]) | ||
| b = np.array([1.0, np.nan]) | ||
| # NaNs compare equal by default | ||
| assert assert_eq(a, b) |
There was a problem hiding this comment.
| assert assert_eq(a, b) | |
| assert_eq(a, b) |
| a = np.array([1.0, np.nan]) | ||
| b = np.array([1.0, np.nan]) |
There was a problem hiding this comment.
testing two numpy arrays is not terribly useful for a dask-specific tool
|
Thanks @crusaderky! Addressed all the points: dropped the |
|
Thanks for the review @crusaderky! Addressed in 85e0e0c: removed the |
Co-authored-by: Guido Imperiale <[email protected]>
The array
assert_eqtesting helper only had a scalar test. This adds tests that cover the common behaviours:AssertionErrorcheck_dtype=False)equal_nandefault vsequal_nan=False)Closes #2682