Skip to content

Commit ddb460b

Browse files
authored
Merge pull request #137 from FelixWodaczek/fix_dii_tests_pyversion
Fix DII unittests for newer Python versions
2 parents 1cf3774 + 3e4f0b2 commit ddb460b

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

dadapy/feature_weighting.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ def return_lasso_optimization_dii_search(
697697
end = time.time()
698698
if self.verb:
699699
print(
700-
f"optimization with l1-penalty {i+1} of strength "
700+
f"optimization with l1-penalty {i + 1} of strength "
701701
+ f"{l1_penalties[i]:.4g} took: {end - start:.2f} s.",
702702
)
703703

tests/test_feature_weighting/test_differentiable_imbalance.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
def test_typing():
2929
"""Test typing decorator function."""
3030
data = rng.random((10, 5))
31-
for dtype in [np.float16, np.float32, np.double, np.float64, np.float128]:
31+
for dtype in [np.float16, np.float32, np.double, np.float64]:
3232
# This should run with only floats as input arrays
3333
dist_mat = dii._return_full_dist_matrix(
3434
data.astype(dtype), period=np.zeros(5, dtype=dtype), n_jobs=1, cythond=True
@@ -45,7 +45,6 @@ def cast_func(*args, **kwargs):
4545
assert cast_func(np.zeros(10, dtype=np.int64))[0][0].dtype == np.int64
4646

4747
assert cast_func(np.zeros(10, dtype=np.float16))[0][0].dtype == dii.CYTHON_DTYPE
48-
assert cast_func(np.zeros(10, dtype=np.float128))[0][0].dtype == dii.CYTHON_DTYPE
4948
assert cast_func(np.zeros(10, dtype=np.double))[0][0].dtype == dii.CYTHON_DTYPE
5049

5150
assert cast_func(0, test=np.zeros(10, dtype=np.float16))[0][0] == 0

tests/test_feature_weighting/test_selection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def test_maxk_warning():
7171
data = rng.random((10, 5))
7272
feature_selection = FeatureWeighting(data, maxk=3)
7373

74-
with pytest.warns():
74+
with pytest.warns(UserWarning):
7575
feature_selection.return_dii_gradient(Data(data), weights=np.zeros(5))
7676

7777

0 commit comments

Comments
 (0)