Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9d07dfc

Browse files
committed
ENH tests now use the new utils module instead of the deprecated cbook module
1 parent 9958f4e commit 9d07dfc

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ def tk_window_focus():
10941094
'matplotlib.tests.test_backend_pgf',
10951095
'matplotlib.tests.test_basic',
10961096
'matplotlib.tests.test_bbox_tight',
1097-
'matplotlib.tests.test_cbook',
1097+
'matplotlib.tests.test_utils',
10981098
'matplotlib.tests.test_colorbar',
10991099
'matplotlib.tests.test_colors',
11001100
'matplotlib.tests.test_contour',

lib/matplotlib/tests/test_cbook.py renamed to lib/matplotlib/tests/test_utils.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
from __future__ import print_function
22
import numpy as np
33
from numpy.testing.utils import assert_array_equal
4-
import matplotlib._cbook as _cbook
4+
import matplotlib.utils as utils
55
import matplotlib.colors as mcolors
66

7-
from matplotlib._cbook import delete_masked_points as dmp
7+
from matplotlib.utils import delete_masked_points as dmp
88
from nose.tools import assert_equal, raises
99
from datetime import datetime
1010

1111

1212
def test_is_string_like():
13-
y = np.arange( 10 )
14-
assert_equal( _cbook.is_string_like( y ), False )
13+
y = np.arange(0)
14+
assert_equal(utils.is_string_like(y), False)
1515
y.shape = 10, 1
16-
assert_equal( _cbook.is_string_like( y ), False )
16+
assert_equal(utils.is_string_like(y), False)
1717
y.shape = 1, 10
18-
assert_equal( _cbook.is_string_like( y ), False )
18+
assert_equal(utils.is_string_like(y), False)
1919

20-
assert _cbook.is_string_like( "hello world" )
21-
assert_equal( _cbook.is_string_like(10), False )
20+
assert utils.is_string_like("hello world")
21+
assert_equal(utils.is_string_like(10), False)
2222

2323

2424
def test_restrict_dict():
2525
d = {'foo': 'bar', 1: 2}
26-
d1 = _cbook.restrict_dict(d, ['foo', 1])
26+
d1 = utils.restrict_dict(d, ['foo', 1])
2727
assert_equal(d1, d)
28-
d2 = _cbook.restrict_dict(d, ['bar', 2])
28+
d2 = utils.restrict_dict(d, ['bar', 2])
2929
assert_equal(d2, {})
30-
d3 = _cbook.restrict_dict(d, {'foo': 1})
30+
d3 = utils.restrict_dict(d, {'foo': 1})
3131
assert_equal(d3, {'foo': 'bar'})
32-
d4 = _cbook.restrict_dict(d, {})
32+
d4 = utils.restrict_dict(d, {})
3333
assert_equal(d4, {})
34-
d5 = _cbook.restrict_dict(d, set(['foo',2]))
34+
d5 = utils.restrict_dict(d, set(['foo', 2]))
3535
assert_equal(d5, {'foo': 'bar'})
3636
# check that d was not modified
3737
assert_equal(d, {'foo': 'bar', 1: 2})
@@ -40,8 +40,8 @@ def test_restrict_dict():
4040
class Test_delete_masked_points:
4141
def setUp(self):
4242
self.mask1 = [False, False, True, True, False, False]
43-
self.arr0 = np.arange(1.0,7.0)
44-
self.arr1 = [1,2,3,np.nan,np.nan,6]
43+
self.arr0 = np.arange(1.0, 7.0)
44+
self.arr1 = [1, 2, 3, np.nan, np.nan, 6]
4545
self.arr2 = np.array(self.arr1)
4646
self.arr3 = np.ma.array(self.arr2, mask=self.mask1)
4747
self.arr_s = ['a', 'b', 'c', 'd', 'e', 'f']
@@ -82,11 +82,11 @@ def test_rgba(self):
8282

8383

8484
def test_allequal():
85-
assert(_cbook.allequal([1, 1, 1]))
86-
assert(not _cbook.allequal([1, 1, 0]))
87-
assert(_cbook.allequal([]))
88-
assert(_cbook.allequal(('a', 'a')))
89-
assert(not _cbook.allequal(('a', 'b')))
85+
assert(utils.allequal([1, 1, 1]))
86+
assert(not utils.allequal([1, 1, 0]))
87+
assert(utils.allequal([]))
88+
assert(utils.allequal(('a', 'a')))
89+
assert(not utils.allequal(('a', 'b')))
9090

9191
if __name__ == "__main__":
9292
import nose

0 commit comments

Comments
 (0)