From b5e64d97f719b6e8fdb200176e166ab464959991 Mon Sep 17 00:00:00 2001 From: Anton Korosov Date: Thu, 20 Aug 2020 08:43:11 +0200 Subject: [PATCH] #481 add tests --- nansat/tests/test_utils.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nansat/tests/test_utils.py b/nansat/tests/test_utils.py index 8f4745bb5..9c135540f 100644 --- a/nansat/tests/test_utils.py +++ b/nansat/tests/test_utils.py @@ -21,13 +21,15 @@ from mock import patch try: - from matplotlib.colors import hex2color + import matplotlib except ImportError: MATPLOTLIB_IS_INSTALLED = False else: MATPLOTLIB_IS_INSTALLED = True + import matplotlib.pyplot as plt + from matplotlib.colors import hex2color -from nansat.utils import get_random_color, parse_time +from nansat.utils import get_random_color, parse_time, register_colormaps from nansat.tests import nansat_test_data as ntd @@ -57,3 +59,9 @@ def test_parse_time_incorrect(self): dt = parse_time('2016-01-19Z') self.assertEqual(type(dt), datetime.datetime) + + @unittest.skipUnless(MATPLOTLIB_IS_INSTALLED, 'Matplotlib is required') + def test_register_colormaps(self): + register_colormaps() + self.assertIn('obpg', plt.colormaps()) + self.assertIn('ak01', plt.colormaps())