Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 51876fc

Browse files
committed
add tests
1 parent 1b76817 commit 51876fc

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/matplotlib/tests/test_gridspec.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import unittest
12
import matplotlib.gridspec as gridspec
23
import matplotlib.pyplot as plt
34
import pytest
@@ -27,6 +28,14 @@ def test_height_ratios():
2728
gridspec.GridSpec(1, 1, height_ratios=[2, 1, 3])
2829

2930

31+
def test_SubplotParams():
32+
s = gridspec.SubplotParams(.1, .1, .9, .9)
33+
assert s.left == 0.1
34+
35+
with pytest.raises(ValueError):
36+
s = gridspec.SubplotParams(.1, .1, .09, .9)
37+
38+
3039
def test_repr():
3140
ss = gridspec.GridSpec(3, 3)[2, 1:3]
3241
assert repr(ss) == "GridSpec(3, 3)[2:3, 1:3]"
@@ -48,3 +57,8 @@ def test_subplotspec_args():
4857
gs = gridspec.GridSpecFromSubplotSpec(2, 1, subplot_spec=axs[0])
4958
with pytest.raises(TypeError, match="subplot_spec must be type SubplotSpec"):
5059
gs = gridspec.GridSpecFromSubplotSpec(2, 1, subplot_spec=axs)
60+
61+
s = gridspec.SubplotParams(.1, .1, .9, .9)
62+
p = unittest.mock.MagicMock()
63+
s._repr_pretty_(p, False)
64+
assert 'SubplotParams' in p.method_calls[0].args[0]

0 commit comments

Comments
 (0)