From 368a2419312097167bc53c2bd51cce152bf09f1e Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 2 Jul 2020 10:26:28 -0400 Subject: [PATCH] added testing of __iadd__ and __invert__ --- python/tests/test_Colormap.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/python/tests/test_Colormap.py b/python/tests/test_Colormap.py index fcc2eca81..f288ffb24 100644 --- a/python/tests/test_Colormap.py +++ b/python/tests/test_Colormap.py @@ -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)) -