MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_colormap_equals

Function test_colormap_equals

lib/matplotlib/tests/test_colors.py:132–153  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

130
131
132def test_colormap_equals():
133 cmap = mpl.colormaps["plasma"]
134 cm_copy = cmap.copy()
135 # different object id's
136 assert cm_copy is not cmap
137 # But the same data should be equal
138 assert cm_copy == cmap
139 # Change the copy
140 with pytest.warns(PendingDeprecationWarning):
141 cm_copy.set_bad('y')
142 assert cm_copy != cmap
143 # Make sure we can compare different sizes without failure
144 cm_copy._lut = cm_copy._lut[:10, :]
145 assert cm_copy != cmap
146 # Test different names are equal if the lookup table is the same
147 cm_copy = cmap.copy()
148 cm_copy.name = "Test"
149 assert cm_copy == cmap
150 # Test colorbar extends
151 cm_copy = cmap.copy()
152 cm_copy.colorbar_extend = not cmap.colorbar_extend
153 assert cm_copy != cmap
154
155
156def test_colormap_endian():

Callers

nothing calls this directly

Calls 2

set_badMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…