8000 Add invalid LogNorm limits test · matplotlib/matplotlib@c56c551 · GitHub
[go: up one dir, main page]

Skip to content

Commit c56c551

Browse files
committed
Add invalid LogNorm limits test
1 parent 1b96a31 commit c56c551

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/matplotlib/tests/test_colors.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ def test_BoundaryNorm():
145145
assert np.all(bn(vals).mask)
146146

147147

148+
@pytest.mark.parametrize("vmin,vmax", [[-1, 2], [3, 1]])
149+
def test_lognorm_invalid(vmin, vmax):
150+
# Check that invalid limits in LogNorm error
151+
norm = mcolors.LogNorm(vmin=vmin, vmax=vmax)
152+
with pytest.raises(ValueError):
153+
norm(1)
154+
with pytest.raises(ValueError):
155+
norm.inverse(1)
156+
157+
148158
def test_LogNorm():
149159
"""
150160
LogNorm ignored clip, now it has the same

0 commit comments

Comments
 (0)
0