Skip to content

Commit

Permalink
#481 add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
akorosov committed Aug 20, 2020
1 parent 9bb34c0 commit b5e64d9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions nansat/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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())

0 comments on commit b5e64d9

Please sign in to comment.