tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
python312Packages.hdmedians: replace nose with pytest
Martin Weinelt
2 years ago
75228216
34a07e8f
+96
-2
2 changed files
expand all
collapse all
unified
split
pkgs
development
python-modules
hdmedians
default.nix
replace-nose.patch
+5
-2
pkgs/development/python-modules/hdmedians/default.nix
reviewed
···
5
5
cython,
6
6
numpy,
7
7
oldest-supported-numpy,
8
8
-
pynose,
9
8
pytestCheckHook,
10
9
setuptools,
11
10
}:
···
20
19
hash = "sha256-tHrssWdx4boHNlVyVdgK4CQLCRVr/0NDId5VmzWawtY=";
21
20
};
22
21
22
22
+
patches = [
23
23
+
# https://github.com/daleroberts/hdmedians/pull/10
24
24
+
./replace-nose.patch
25
25
+
];
26
26
+
23
27
postPatch = ''
24
28
substituteInPlace setup.py \
25
29
--replace-fail "'nose>=1.0'," ""
···
36
40
pythonImportsCheck = [ "hdmedians" ];
37
41
38
42
nativeCheckInputs = [
39
39
-
pynose
40
43
pytestCheckHook
41
44
];
42
45
+91
pkgs/development/python-modules/hdmedians/replace-nose.patch
reviewed
···
1
1
+
diff --git a/hdmedians/tests/test_geomedian.py b/hdmedians/tests/test_geomedian.py
2
2
+
index 0bc37e9..ff5f938 100644
3
3
+
--- a/hdmedians/tests/test_geomedian.py
4
4
+
+++ b/hdmedians/tests/test_geomedian.py
5
5
+
@@ -4,9 +4,9 @@ Tests.
6
6
+
7
7
+
import numpy as np
8
8
+
import hdmedians as hd
9
9
+
+import pytest
10
10
+
11
11
+
from numpy.testing import assert_equal, assert_array_almost_equal
12
12
+
-from nose.tools import assert_true, assert_raises
13
13
+
14
14
+
# shape (6, 25)
15
15
+
DATA1 = np.array([[693, 990, 1281, 2101, 3524, 2577],
16
16
+
@@ -124,10 +124,12 @@ def test_nangeomedian_axis_one_two_good():
17
17
+
def test_nangeomedian_axis_bad():
18
18
+
data = np.array([[1.0, np.nan, 1.0],
19
19
+
[2.0, 1.0, 1.0]])
20
20
+
- assert_raises(IndexError, hd.nangeomedian, data, axis=2)
21
21
+
+ with pytest.raises(IndexError):
22
22
+
+ hd.nangeomedian(data, axis=2)
23
23
+
24
24
+
25
25
+
def test_nangeomedian_all_nan():
26
26
+
data = np.array([[np.nan, np.nan, np.nan],
27
27
+
[np.nan, np.nan, np.nan]])
28
28
+
- assert_raises(ValueError, hd.nangeomedian, data)
29
29
+
+ with pytest.raises(ValueError):
30
30
+
+ hd.nangeomedian(data)
31
31
+
diff --git a/hdmedians/tests/test_medoid.py b/hdmedians/tests/test_medoid.py
32
32
+
index c5e0a7f..4fbdf80 100644
33
33
+
--- a/hdmedians/tests/test_medoid.py
34
34
+
+++ b/hdmedians/tests/test_medoid.py
35
35
+
@@ -4,9 +4,9 @@ Tests.
36
36
+
37
37
+
import numpy as np
38
38
+
import hdmedians as hd
39
39
+
+import pytest
40
40
+
41
41
+
from numpy.testing import assert_equal, assert_array_almost_equal
42
42
+
-from nose.tools import assert_true, assert_raises
43
43
+
44
44
+
# shape (6, 25)
45
45
+
DATA1 = np.array([[693, 990, 1281, 2101, 3524, 2577],
46
46
+
@@ -59,7 +59,7 @@ def test_medoid_in_set_random():
47
47
+
s = [list(x) for x in a.T]
48
48
+
m = hd.medoid(a)
49
49
+
idx = s.index(list(m))
50
50
+
- assert_true(idx > -1)
51
51
+
+ assert(idx > -1)
52
52
+
53
53
+
54
54
+
def test_medoid_noaxis():
55
55
+
@@ -85,7 +85,8 @@ def test_medoid_axis_one():
56
56
+
57
57
+
58
58
+
def test_medoid_axis_bad():
59
59
+
- assert_raises(IndexError, hd.medoid, DATA1, axis=2)
60
60
+
+ with pytest.raises(IndexError):
61
61
+
+ hd.medoid(DATA1, axis=2)
62
62
+
63
63
+
64
64
+
def test_medoid_noaxis_indexonly():
65
65
+
@@ -136,7 +137,8 @@ def test_nanmedoid_two_obs():
66
66
+
def test_nanmedoid_all_nan():
67
67
+
data = np.array([[np.nan, np.nan, np.nan],
68
68
+
[np.nan, np.nan, np.nan]])
69
69
+
- assert_raises(ValueError, hd.nanmedoid, data)
70
70
+
+ with pytest.raises(ValueError):
71
71
+
+ hd.nanmedoid(data)
72
72
+
73
73
+
74
74
+
def test_nanmedoid_axis_zero():
75
75
+
@@ -170,7 +172,8 @@ def test_nanmedoid_axis_one_indexonly():
76
76
+
77
77
+
78
78
+
def test_nanmedoid_axis_bad():
79
79
+
- assert_raises(IndexError, hd.nanmedoid, DATA1, axis=2)
80
80
+
+ with pytest.raises(IndexError):
81
81
+
+ hd.nanmedoid(DATA1, axis=2)
82
82
+
83
83
+
84
84
+
def test_nanmedoid_two_obs():
85
85
+
@@ -184,4 +187,5 @@ def test_nanmedoid_two_obs():
86
86
+
def test_nanmedoid_all_nan():
87
87
+
data = np.array([[np.nan, np.nan, np.nan],
88
88
+
[np.nan, np.nan, np.nan]])
89
89
+
- assert_raises(ValueError, hd.nanmedoid, data)
90
90
+
+ with pytest.raises(ValueError):
91
91
+
+ hd.nanmedoid(data)