added testing of __iadd__ and __invert__

This commit is contained in:
Philip Eisenlohr 2020-07-02 10:26:28 -04:00
parent 5a96708f41
commit 368a241931
1 changed files with 11 additions and 1 deletions

View File

@ -118,6 +118,17 @@ class TestColormap:
assert (not np.allclose(c_1.colors,c_2.colors)) and \
np.allclose(c_1.colors,c_2.reversed().colors)
def test_invert(self):
c_1 = Colormap.from_predefined('strain')
c_2 = ~c_1
assert (not np.allclose(c_1.colors,c_2.colors)) and \
np.allclose(c_1.colors,(~c_2).colors)
def test_add(self):
c = Colormap.from_predefined('jet')
c += c
assert (np.allclose(c.colors[:len(c.colors)],c.colors[len(c.colors):]))
def test_list(self):
Colormap.list_predefined()
@ -138,4 +149,3 @@ class TestColormap:
c.to_file(format=format)
time.sleep(.5)
assert filecmp.cmp(tmpdir/(name+ext),reference_dir/(name+ext))