File tree 2 files changed +22
-0
lines changed
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 16
16
import matplotlib .colorbar as mcolorbar
17
17
import matplotlib .cbook as cbook
18
18
import matplotlib .pyplot as plt
19
+ import matplotlib .scale as mscale
19
20
from matplotlib .testing .decorators import image_comparison
20
21
21
22
@@ -1268,6 +1269,7 @@ def test_repr_html():
1268
1269
png = cmap ._repr_png_ ()
1269
1270
assert base64 .b64encode (png ).decode ('ascii' ) in html
1270
1271
assert cmap .name in html
1272
+ < << << << HEAD
1271
1273
assert html .startswith ('<div' )
1272
1274
assert html .endswith ('</div>' )
1273
1275
@@ -1320,3 +1322,16 @@ def test_2d_to_rgba():
1320
1322
rgba_1d = mcolors .to_rgba (color .reshape (- 1 ))
1321
1323
rgba_2d = mcolors .to_rgba (color .reshape ((1 , - 1 )))
1322
1324
assert rgba_1d == rgba_2d
1325
+
1326
+
1327
+ def test_norm_deepcopy ():
1328
+ norm = mcolors .LogNorm ()
1329
+ norm .vmin = 0.0002
1330
+ norm2 = copy .deepcopy (norm )
1331
+ assert norm2 .vmin == norm .vmin
1332
+ assert isinstance (norm2 ._scale , mscale .LogScale )
1333
+ norm = mcolors .Normalize ()
1334
+ norm .vmin = 0.0002
1335
+ norm2 = copy .deepcopy (norm )
1336
+ assert isinstance (norm2 ._scale , mscale .LinearScale )
1337
+ assert norm2 .vmin == norm .vmin
Original file line number Diff line number Diff line change 7
7
8
8
import numpy as np
9
9
from numpy .testing import assert_allclose
10
+ import copy
10
11
import io
11
12
import pytest
12
13
@@ -210,3 +211,9 @@ def test_pass_scale():
210
211
ax .set_yscale (scale )
211
212
assert ax .xaxis .get_scale () == 'log'
212
213
assert ax .yaxis .get_scale () == 'log'
214
+
215
+
216
+ def test_scale_deepcopy ():
217
+ sc = mscale .LogScale (axis = 'x' , base = 10 )
218
+ sc2 = copy .deepcopy (sc )
219
+ assert str (sc .get_transform ()) == str (sc2 .get_transform ())
You can’t perform that action at this time.
0 commit comments