at master 2.9 kB view raw
1diff --git a/hdmedians/tests/test_geomedian.py b/hdmedians/tests/test_geomedian.py 2index 0bc37e9..ff5f938 100644 3--- a/hdmedians/tests/test_geomedian.py 4+++ b/hdmedians/tests/test_geomedian.py 5@@ -4,9 +4,9 @@ Tests. 6 7 import numpy as np 8 import hdmedians as hd 9+import pytest 10 11 from numpy.testing import assert_equal, assert_array_almost_equal 12-from nose.tools import assert_true, assert_raises 13 14 # shape (6, 25) 15 DATA1 = np.array([[693, 990, 1281, 2101, 3524, 2577], 16@@ -124,10 +124,12 @@ def test_nangeomedian_axis_one_two_good(): 17 def test_nangeomedian_axis_bad(): 18 data = np.array([[1.0, np.nan, 1.0], 19 [2.0, 1.0, 1.0]]) 20- assert_raises(IndexError, hd.nangeomedian, data, axis=2) 21+ with pytest.raises(IndexError): 22+ hd.nangeomedian(data, axis=2) 23 24 25 def test_nangeomedian_all_nan(): 26 data = np.array([[np.nan, np.nan, np.nan], 27 [np.nan, np.nan, np.nan]]) 28- assert_raises(ValueError, hd.nangeomedian, data) 29+ with pytest.raises(ValueError): 30+ hd.nangeomedian(data) 31diff --git a/hdmedians/tests/test_medoid.py b/hdmedians/tests/test_medoid.py 32index c5e0a7f..4fbdf80 100644 33--- a/hdmedians/tests/test_medoid.py 34+++ b/hdmedians/tests/test_medoid.py 35@@ -4,9 +4,9 @@ Tests. 36 37 import numpy as np 38 import hdmedians as hd 39+import pytest 40 41 from numpy.testing import assert_equal, assert_array_almost_equal 42-from nose.tools import assert_true, assert_raises 43 44 # shape (6, 25) 45 DATA1 = np.array([[693, 990, 1281, 2101, 3524, 2577], 46@@ -59,7 +59,7 @@ def test_medoid_in_set_random(): 47 s = [list(x) for x in a.T] 48 m = hd.medoid(a) 49 idx = s.index(list(m)) 50- assert_true(idx > -1) 51+ assert(idx > -1) 52 53 54 def test_medoid_noaxis(): 55@@ -85,7 +85,8 @@ def test_medoid_axis_one(): 56 57 58 def test_medoid_axis_bad(): 59- assert_raises(IndexError, hd.medoid, DATA1, axis=2) 60+ with pytest.raises(IndexError): 61+ hd.medoid(DATA1, axis=2) 62 63 64 def test_medoid_noaxis_indexonly(): 65@@ -136,7 +137,8 @@ def test_nanmedoid_two_obs(): 66 def test_nanmedoid_all_nan(): 67 data = np.array([[np.nan, np.nan, np.nan], 68 [np.nan, np.nan, np.nan]]) 69- assert_raises(ValueError, hd.nanmedoid, data) 70+ with pytest.raises(ValueError): 71+ hd.nanmedoid(data) 72 73 74 def test_nanmedoid_axis_zero(): 75@@ -170,7 +172,8 @@ def test_nanmedoid_axis_one_indexonly(): 76 77 78 def test_nanmedoid_axis_bad(): 79- assert_raises(IndexError, hd.nanmedoid, DATA1, axis=2) 80+ with pytest.raises(IndexError): 81+ hd.nanmedoid(DATA1, axis=2) 82 83 84 def test_nanmedoid_two_obs(): 85@@ -184,4 +187,5 @@ def test_nanmedoid_two_obs(): 86 def test_nanmedoid_all_nan(): 87 data = np.array([[np.nan, np.nan, np.nan], 88 [np.nan, np.nan, np.nan]]) 89- assert_raises(ValueError, hd.nanmedoid, data) 90+ with pytest.raises(ValueError): 91+ hd.nanmedoid(data)