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

Skip to content

Commit 7e8a940

Browse files
authored
Added tests for Colormap copy
1 parent 3ece4cb commit 7e8a940

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

lib/matplotlib/tests/test_colors.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33

4+
import copy
45
import six
56
import itertools
67
import warnings
@@ -21,7 +22,19 @@
2122
import matplotlib.pyplot as plt
2223
from matplotlib.testing.decorators import image_comparison
2324

24-
25+
def test_copy():
26+
cm = plt.cm.Reds
27+
cm([-1, 0, .5, np.nan, np.inf])
28+
cm.set_bad('y')
29+
cm2 = copy.copy(cm)
30+
cm2.set_bad('b')
31+
cm.set_under('k')
32+
cm2.set_under('r')
33+
cm.set_over('c')
34+
cm2.set_over('m')
35+
36+
assert_equal(np.not_equal(cm._lut, cm2._lut), True)
37+
2538
def test_resample():
2639
"""
2740
Github issue #6025 pointed to incorrect ListedColormap._resample;

0 commit comments

Comments
 (0)