Skip to content

Commit adebaa3

Browse files
committed
add tests
1 parent d6d5386 commit adebaa3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/matplotlib/tests/test_gridspec.py

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import unittest
12
import matplotlib.gridspec as gridspec
23
import pytest
34

@@ -26,6 +27,14 @@ def test_height_ratios():
2627
gridspec.GridSpec(1, 1, height_ratios=[2, 1, 3])
2728

2829

30+
def test_SubplotParams():
31+
s = gridspec.SubplotParams(.1, .1, .9, .9)
32+
assert s.left == 0.1
33+
34+
with pytest.raises(ValueError):
35+
s = gridspec.SubplotParams(.1, .1, .09, .9)
36+
37+
2938
def test_repr():
3039
ss = gridspec.GridSpec(3, 3)[2, 1:3]
3140
assert repr(ss) == "GridSpec(3, 3)[2:3, 1:3]"
@@ -35,3 +44,8 @@ def test_repr():
3544
width_ratios=(1, 3))
3645
assert repr(ss) == \
3746
"GridSpec(2, 2, height_ratios=(3, 1), width_ratios=(1, 3))"
47+
48+
s = gridspec.SubplotParams(.1, .1, .9, .9)
49+
p = unittest.mock.MagicMock()
50+
s._repr_pretty_(p, False)
51+
assert 'SubplotParams' in p.method_calls[0].args[0]

0 commit comments

Comments
 (0)