| 130 | |
| 131 | |
| 132 | def 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 | |
| 156 | def test_colormap_endian(): |