3
3
4
4
import six
5
5
import itertools
6
+ import pytest
6
7
from distutils .version import LooseVersion as V
7
8
8
- from nose .tools import assert_raises , assert_equal , assert_true
9
- from nose .tools import assert_sequence_equal
10
-
11
- try :
12
- # this is not available in nose + py2.6
13
- from nose .tools import assert_sequence_equal
14
- except ImportError :
15
- assert_sequence_equal = None
16
-
17
9
import numpy as np
10
+
11
+ from numpy .testing import assert_raises , assert_equal
18
12
from numpy .testing .utils import assert_array_equal , assert_array_almost_equal
19
- from nose .plugins .skip import SkipTest
20
13
21
14
from matplotlib import cycler
22
15
import matplotlib
@@ -103,7 +96,7 @@ def test_BoundaryNorm():
103
96
expected = [- 1 , 0 , 1 , 2 ]
104
97
for v , ex in zip (vals , expected ):
105
98
ret = bn (v )
106
- assert_true ( isinstance (ret , six .integer_types ) )
99
+ assert isinstance (ret , six .integer_types )
107
100
assert_array_equal (ret , ex )
108
101
assert_array_equal (bn ([v ]), ex )
109
102
@@ -112,7 +105,7 @@ def test_BoundaryNorm():
112
105
expected = [- 1 , 0 , 2 , 3 ]
113
106
for v , ex in zip (vals , expected ):
114
107
ret = bn (v )
115
- assert_true ( isinstance (ret , six .integer_types ) )
108
+ assert isinstance (ret , six .integer_types )
116
109
assert_array_equal (ret , ex )
117
110
assert_array_equal (bn ([v ]), ex )
118
111
@@ -121,7 +114,7 @@ def test_BoundaryNorm():
121
114
expected = [0 , 0 , 2 , 2 ]
122
115
for v , ex in zip (vals , expected ):
123
116
ret = bn (v )
124
- assert_true ( isinstance (ret , six .integer_types ) )
117
+ assert isinstance (ret , six .integer_types )
125
118
assert_array_equal (ret , ex )
126
119
assert_array_equal (bn ([v ]), ex )
127
120
@@ -142,9 +135,9 @@ def test_BoundaryNorm():
142
135
143
136
# Non-trivial masked arrays
144
137
vals = np .ma .masked_invalid ([np .Inf , np .NaN ])
145
- assert_true ( np .all (bn (vals ).mask ) )
138
+ assert np .all (bn (vals ).mask )
146
139
vals = np .ma .masked_invalid ([np .Inf ])
147
- assert_true ( np .all (bn (vals ).mask ) )
140
+ assert np .all (bn (vals ).mask )
148
141
149
142
150
143
def test_LogNorm ():
@@ -606,20 +599,15 @@ def _azimuth2math(azimuth, elevation):
606
599
607
600
608
601
def test_pandas_iterable ():
609
- try :
610
- import pandas as pd
611
- except ImportError :
612
- raise SkipTest ("Pandas not installed" )
613
- if assert_sequence_equal is None :
614
- raise SkipTest ("nose lacks required function" )
602
+ pd = pytest .importorskip ('pandas' )
615
603
# Using a list or series yields equivalent
616
604
# color maps, i.e the series isn't seen as
617
605
# a single color
618
606
lst = ['red' , 'blue' , 'green' ]
619
607
s = pd .Series (lst )
620
608
cm1 = mcolors .ListedColormap (lst , N = 5 )
621
609
cm2 = mcolors .ListedColormap (s , N = 5 )
622
- assert_sequence_equal (cm1 .colors , cm2 .colors )
610
+ assert_array_equal (cm1 .colors , cm2 .colors )
623
611
624
612
625
613
def test_colormap_reversing ():
@@ -684,8 +672,3 @@ def test_tableau_order():
684
672
'#bcbd22' , '#17becf' ]
685
673
686
674
assert list (mcolors .TABLEAU_COLORS .values ()) == dflt_cycle
687
-
688
-
689
- if __name__ == '__main__' :
690
- import nose
691
- nose .runmodule (argv = ['-s' , '--with-doctest' ], exit = False )
0 commit comments