1
1
from __future__ import print_function
2
2
import numpy as np
3
3
from numpy .testing .utils import assert_array_equal
4
- import matplotlib ._cbook as _cbook
4
+ import matplotlib .utils as utils
5
5
import matplotlib .colors as mcolors
6
6
7
- from matplotlib ._cbook import delete_masked_points as dmp
7
+ from matplotlib .utils import delete_masked_points as dmp
8
8
from nose .tools import assert_equal , raises
9
9
from datetime import datetime
10
10
11
11
12
12
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 )
15
15
y .shape = 10 , 1
16
- assert_equal ( _cbook .is_string_like ( y ), False )
16
+ assert_equal (utils .is_string_like (y ), False )
17
17
y .shape = 1 , 10
18
- assert_equal ( _cbook .is_string_like ( y ), False )
18
+ assert_equal (utils .is_string_like (y ), False )
19
19
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 )
22
22
23
23
24
24
def test_restrict_dict ():
25
25
d = {'foo' : 'bar' , 1 : 2 }
26
- d1 = _cbook .restrict_dict (d , ['foo' , 1 ])
26
+ d1 = utils .restrict_dict (d , ['foo' , 1 ])
27
27
assert_equal (d1 , d )
28
- d2 = _cbook .restrict_dict (d , ['bar' , 2 ])
28
+ d2 = utils .restrict_dict (d , ['bar' , 2 ])
29
29
assert_equal (d2 , {})
30
- d3 = _cbook .restrict_dict (d , {'foo' : 1 })
30
+ d3 = utils .restrict_dict (d , {'foo' : 1 })
31
31
assert_equal (d3 , {'foo' : 'bar' })
32
- d4 = _cbook .restrict_dict (d , {})
32
+ d4 = utils .restrict_dict (d , {})
33
33
assert_equal (d4 , {})
34
- d5 = _cbook .restrict_dict (d , set (['foo' ,2 ]))
34
+ d5 = utils .restrict_dict (d , set (['foo' , 2 ]))
35
35
assert_equal (d5 , {'foo' : 'bar' })
36
36
# check that d was not modified
37
37
assert_equal (d , {'foo' : 'bar' , 1 : 2 })
@@ -40,8 +40,8 @@ def test_restrict_dict():
40
40
class Test_delete_masked_points :
41
41
def setUp (self ):
42
42
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 ]
45
45
self .arr2 = np .array (self .arr1 )
46
46
self .arr3 = np .ma .array (self .arr2 , mask = self .mask1 )
47
47
self .arr_s = ['a' , 'b' , 'c' , 'd' , 'e' , 'f' ]
@@ -82,11 +82,11 @@ def test_rgba(self):
82
82
83
83
84
84
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' )))
90
90
91
91
if __name__ == "__main__" :
92
92
import nose
0 commit comments