1010
1111from numpy .testing import assert_array_equal , assert_array_almost_equal
1212
13- from matplotlib import cycler
13+ from matplotlib import _api , cbook , cm , cycler
1414import matplotlib
1515import matplotlib .colors as mcolors
16- import matplotlib .cm as cm
1716import matplotlib .colorbar as mcolorbar
18- import matplotlib .cbook as cbook
1917import matplotlib .pyplot as plt
2018import matplotlib .scale as mscale
2119from matplotlib .testing .decorators import image_comparison , check_figures_equal
@@ -109,7 +107,7 @@ def test_colormap_global_set_warn():
109107 new_cm = plt .get_cmap ('viridis' )
110108 # Store the old value so we don't override the state later on.
111109 orig_cmap = copy .copy (new_cm )
112- with pytest .warns (cbook .MatplotlibDeprecationWarning ,
110+ with pytest .warns (_api .MatplotlibDeprecationWarning ,
113111 match = "You are modifying the state of a globally" ):
114112 # This should warn now because we've modified the global state
115113 new_cm .set_under ('k' )
@@ -120,7 +118,7 @@ def test_colormap_global_set_warn():
120118 # Test that registering and then modifying warns
121119 plt .register_cmap (name = 'test_cm' , cmap = copy .copy (orig_cmap ))
122120 new_cm = plt .get_cmap ('test_cm' )
123- with pytest .warns (cbook .MatplotlibDeprecationWarning ,
121+ with pytest .warns (_api .MatplotlibDeprecationWarning ,
124122 match = "You are modifying the state of a globally" ):
125123 # This should warn now because we've modified the global state
126124 new_cm .set_under ('k' )
@@ -132,11 +130,11 @@ def test_colormap_global_set_warn():
132130
133131def test_colormap_dict_deprecate ():
134132 # Make sure we warn on get and set access into cmap_d
135- with pytest .warns (cbook .MatplotlibDeprecationWarning ,
133+ with pytest .warns (_api .MatplotlibDeprecationWarning ,
136134 match = "The global colormaps dictionary is no longer" ):
137135 cmap = plt .cm .cmap_d ['viridis' ]
138136
139- with pytest .warns (cbook .MatplotlibDeprecationWarning ,
137+ with pytest .warns (_api .MatplotlibDeprecationWarning ,
140138 match = "The global colormaps dictionary is no longer" ):
141139 plt .cm .cmap_d ['test' ] = cmap
142140
0 commit comments