Skip to content

Commit

Permalink
add a quick test
Browse files Browse the repository at this point in the history
  • Loading branch information
kafitzgerald committed Apr 19, 2024
1 parent f75859d commit 02e09e2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_util.py
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
import pytest
import matplotlib as mpl

from geocat.viz.util import truncate_colormap


def test_truncate_colormap():
cmap = mpl.colormaps['terrain']
truncated_cmap = truncate_colormap(cmap, 0.1, 0.9)

assert isinstance(truncated_cmap, mpl.colors.LinearSegmentedColormap)
assert truncated_cmap(0.0) == cmap(0.1)
assert truncated_cmap(1.0) == cmap(0.9)

0 comments on commit 02e09e2

Please sign in to comment.