Skip to content

Commit 77afdce

Browse files
committed
bugfixes
1 parent 33fb4fc commit 77afdce

File tree

7 files changed

+12
-8
lines changed

7 files changed

+12
-8
lines changed

src/obscure_stats/association/association.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def _check_arrays(x: np.ndarray, y: np.ndarray) -> bool:
3939
stacklevel=2,
4040
)
4141
return True
42-
if (np.isnan(_x).sum() >= len(_x) - 1) or (np.isnan(_y).sum() >= len(_x) - 1):
42+
if (np.isnan(_x).sum() >= len(_x) - 1) or (np.isnan(_y).sum() >= len(_y) - 1):
4343
warnings.warn(
4444
"One of the input arrays has too many missing values,"
4545
" please check the arrays.",
@@ -599,5 +599,5 @@ def quantile_correlation(x: np.ndarray, y: np.ndarray, q: float = 0.5) -> float:
599599
x, y = _prep_arrays(x, y)
600600
return (
601601
np.mean(q - (y - np.quantile(y, q=q) < 0) * (x - np.mean(x)))
602-
/ ((q * q**2) * np.var(x)) ** 0.5
602+
/ ((q - q**2) * np.var(x)) ** 0.5
603603
)

tests/test_association.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,6 @@ def test_corr_boundaries(func: typing.Callable, y_array_float: np.ndarray) -> No
193193
),
194194
)
195195
@pytest.mark.parametrize("func", all_functions)
196-
def test_fuzz_all(func: typing.Callable, x: np.ndarray, y: np.ndarray) -> None:
196+
def test_fuzz_associations(func: typing.Callable, x: np.ndarray, y: np.ndarray) -> None:
197197
"""Test all functions with fuzz."""
198198
func(x, y)

tests/test_central_tendency.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ def test_edge_cases(x_array_float: np.ndarray) -> None:
6666
if result != pytest.approx(x_array_float[0], rel=1e-4):
6767
msg = "Result does not match expected output."
6868
raise ValueError(msg)
69+
result = standard_trimmed_harrell_davis_quantile([])
70+
if result is not np.nan:
71+
msg = "Result does not match expected output."
72+
raise ValueError(msg)
6973

7074

7175
def test_q_in_sthdq(x_array_float: np.ndarray) -> None:
@@ -124,6 +128,6 @@ def test_statistic_with_nans(func: typing.Callable, x_array_nan: np.ndarray) ->
124128
)
125129
)
126130
@pytest.mark.parametrize("func", all_functions)
127-
def test_fuzz_all(func: typing.Callable, data: np.ndarray) -> None:
131+
def test_fuzz_central_tendencies(func: typing.Callable, data: np.ndarray) -> None:
128132
"""Test all functions with fuzz."""
129133
func(data)

tests/test_dispersion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,6 @@ def test_statistic_with_nans(func: typing.Callable, x_array_nan: np.ndarray) ->
101101
)
102102
)
103103
@pytest.mark.parametrize("func", all_functions)
104-
def test_fuzz_all(func: typing.Callable, data: np.ndarray) -> None:
104+
def test_fuzz_dispersions(func: typing.Callable, data: np.ndarray) -> None:
105105
"""Test all functions with fuzz."""
106106
func(data)

tests/test_kurtosis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ def test_statistic_with_nans(func: typing.Callable, x_array_nan: np.ndarray) ->
7070
)
7171
)
7272
@pytest.mark.parametrize("func", all_functions)
73-
def test_fuzz_all(func: typing.Callable, data: np.ndarray) -> None:
73+
def test_fuzz_kurtosises(func: typing.Callable, data: np.ndarray) -> None:
7474
"""Test all functions with fuzz."""
7575
func(data)

tests/test_skewness.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,6 @@ def test_statistic_with_nans(func: typing.Callable, x_array_nan: np.ndarray) ->
9494
)
9595
)
9696
@pytest.mark.parametrize("func", all_functions)
97-
def test_fuzz_all(func: typing.Callable, data: np.ndarray) -> None:
97+
def test_fuzz_skewnesses(func: typing.Callable, data: np.ndarray) -> None:
9898
"""Test all functions with fuzz."""
9999
func(data)

tests/test_variation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ def test_renyi_entropy_edgecases(c_array_obj: np.ndarray) -> None:
8686
)
8787
)
8888
@pytest.mark.parametrize("func", all_functions)
89-
def test_fuzz_all(func: typing.Callable, data: np.ndarray) -> None:
89+
def test_fuzz_variations(func: typing.Callable, data: np.ndarray) -> None:
9090
"""Test all functions with fuzz."""
9191
func(data)

0 commit comments

Comments
 (0)