10
10
11
11
from numpy .testing import assert_array_equal , assert_array_almost_equal
12
12
13
- from matplotlib import cycler
13
+ from matplotlib import _api , cbook , cm , cycler
14
14
import matplotlib
15
15
import matplotlib .colors as mcolors
16
- import matplotlib .cm as cm
17
16
import matplotlib .colorbar as mcolorbar
18
- import matplotlib .cbook as cbook
19
17
import matplotlib .pyplot as plt
20
18
import matplotlib .scale as mscale
21
19
from matplotlib .testing .decorators import image_comparison , check_figures_equal
@@ -109,7 +107,7 @@ def test_colormap_global_set_warn():
109
107
new_cm = plt .get_cmap ('viridis' )
110
108
# Store the old value so we don't override the state later on.
111
109
orig_cmap = copy .copy (new_cm )
112
- with pytest .warns (cbook .MatplotlibDeprecationWarning ,
110
+ with pytest .warns (_api .MatplotlibDeprecationWarning ,
113
111
match = "You are modifying the state of a globally" ):
114
112
# This should warn now because we've modified the global state
115
113
new_cm .set_under ('k' )
@@ -120,7 +118,7 @@ def test_colormap_global_set_warn():
120
118
# Test that registering and then modifying warns
121
119
plt .register_cmap (name = 'test_cm' , cmap = copy .copy (orig_cmap ))
122
120
new_cm = plt .get_cmap ('test_cm' )
123
- with pytest .warns (cbook .MatplotlibDeprecationWarning ,
121
+ with pytest .warns (_api .MatplotlibDeprecationWarning ,
124
122
match = "You are modifying the state of a globally" ):
125
123
# This should warn now because we've modified the global state
126
124
new_cm .set_under ('k' )
@@ -132,11 +130,11 @@ def test_colormap_global_set_warn():
132
130
133
131
def test_colormap_dict_deprecate ():
134
132
# Make sure we warn on get and set access into cmap_d
135
- with pytest .warns (cbook .MatplotlibDeprecationWarning ,
133
+ with pytest .warns (_api .MatplotlibDeprecationWarning ,
136
134
match = "The global colormaps dictionary is no longer" ):
137
135
cmap = plt .cm .cmap_d ['viridis' ]
138
136
139
- with pytest .warns (cbook .MatplotlibDeprecationWarning ,
137
+ with pytest .warns (_api .MatplotlibDeprecationWarning ,
140
138
match = "The global colormaps dictionary is no longer" ):
141
139
plt .cm .cmap_d ['test' ] = cmap
142
140
0 commit comments