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

Skip to content

Commit 9732a3f

Browse files
committed
TST: add simple tests
1 parent 430f5dd commit 9732a3f

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

lib/matplotlib/tests/test_colors.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import matplotlib.colorbar as mcolorbar
1717
import matplotlib.cbook as cbook
1818
import matplotlib.pyplot as plt
19+
import matplotlib.scale as mscale
1920
from matplotlib.testing.decorators import image_comparison
2021

2122

@@ -1268,6 +1269,7 @@ def test_repr_html():
12681269
png = cmap._repr_png_()
12691270
assert base64.b64encode(png).decode('ascii') in html
12701271
assert cmap.name in html
1272+
<<<<<<< HEAD
12711273
assert html.startswith('<div')
12721274
assert html.endswith('</div>')
12731275

@@ -1320,3 +1322,16 @@ def test_2d_to_rgba():
13201322
rgba_1d = mcolors.to_rgba(color.reshape(-1))
13211323
rgba_2d = mcolors.to_rgba(color.reshape((1, -1)))
13221324
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

lib/matplotlib/tests/test_scale.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import numpy as np
99
from numpy.testing import assert_allclose
10+
import copy
1011
import io
1112
import pytest
1213

@@ -210,3 +211,9 @@ def test_pass_scale():
210211
ax.set_yscale(scale)
211212
assert ax.xaxis.get_scale() == 'log'
212213
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())

0 commit comments

Comments
 (0)