Skip to content

Commit 04b5af2

Browse files
committed
fix tests
1 parent bf6878c commit 04b5af2

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

sdmetrics/column_pairs/statistical/correlation_similarity.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ def compute_breakdown(
6565
The values from the real dataset.
6666
synthetic_data (Union[numpy.ndarray, pandas.Series]):
6767
The values from the synthetic dataset.
68+
coefficient (str):
69+
The correlation coefficient to use. Either 'Pearson' or 'Spearman'.
70+
Default is 'Pearson'.
71+
real_correlation_threshold (float):
72+
The minimum absolute correlation value for the real data to be considered
73+
correlated. Default is 0.
6874
6975
Returns:
7076
dict:

tests/unit/column_pairs/statistical/test_correlation_similarity.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def test_compute_breakdown_constant_input(self):
129129
def test_compute_breakdown_with_real_correlation_threshold(
130130
self, real_correlation_threshold, score
131131
):
132-
"""Test the ``compute_breakdown`` method with real correlation threshold.
132+
"""Test the ``compute_breakdown`` method with `real_correlation_threshold`.
133133
134134
In this test, real data has a correlation of 0.498212 and synthetic data
135135
has a correlation of 0.3.
@@ -154,7 +154,11 @@ def test_compute_breakdown_with_real_correlation_threshold(
154154
)
155155

156156
# Assert
157-
assert result['score'] == score if not np.isnan(score) else np.isnan(result['score'])
157+
assert (
158+
np.isclose(result['score'], score, atol=1e-6)
159+
if not np.isnan(score)
160+
else np.isnan(result['score'])
161+
)
158162

159163
def test_compute_breakdown_invalid_real_correlation_threshold(self):
160164
"""Test an error is thrown when an invalid `real_correlation_threshold` is passed."""

0 commit comments

Comments
 (0)