Skip to content

Commit 347edaa

Browse files
refactor: improve assertion clarity and numerical tolerance in tests
- Updated assertion formatting in integration tests for better readability and consistency in error messages. - Adjusted numerical tolerance in `test_pdex.py` to allow for smaller differences, enhancing test robustness.
1 parent 4d2bfa4 commit 347edaa

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

tests/test_integration.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ def _assert_high_correlation(
252252
# Show sample of mismatches
253253
print(results.loc[valid_mask, [col_std, col_low]].head())
254254

255-
assert (
256-
corr > threshold
257-
), f"Correlation for {col} is {corr:.6f}, expected > {threshold}"
255+
assert corr > threshold, (
256+
f"Correlation for {col} is {corr:.6f}, expected > {threshold}"
257+
)
258258

259259

260260
def test_integration_dense_counts():
@@ -499,6 +499,6 @@ def test_integration_varying_chunk_sizes():
499499
y = merged.loc[valid_mask, col_small]
500500

501501
# Use allclose for strict equality check since it's the same algorithm
502-
assert np.allclose(
503-
x, y, equal_nan=True
504-
), f"Mismatch in {col} between chunk sizes"
502+
assert np.allclose(x, y, equal_nan=True), (
503+
f"Mismatch in {col} between chunk sizes"
504+
)

tests/test_pdex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def test_low_memory_float_data_uses_sorting_kernel():
286286
chunked["p_value"],
287287
check_exact=False,
288288
rtol=0,
289-
atol=5e-2,
289+
atol=5e-3,
290290
)
291291
pd.testing.assert_series_equal(
292292
baseline["statistic"],

0 commit comments

Comments
 (0)