8000 Merge pull request #17186 from timhoffm/auto-backport-of-pr-17131-on-… · matplotlib/matplotlib@febbc07 · GitHub
[go: up one dir, main page]

Skip to content

Commit febbc07

Browse files
authored
Merge pull request #17186 from timhoffm/auto-backport-of-pr-17131-on-v3.2.x
Backport PR #17131 on branch v3.2.x
2 parents 5fc89c5 + caa33ae commit febbc07

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/matplotlib/gridspec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ def __init__(self, nrows, ncols, height_ratios=None, width_ratios=None):
4848
self.set_width_ratios(width_ratios)
4949

5050
def __repr__(self):
51-
height_arg = (', height_ratios=%r' % self._row_height_ratios
51+
height_arg = (', height_ratios=%r' % (self._row_height_ratios,)
5252
if self._row_height_ratios is not None else '')
53-
width_arg = (', width_ratios=%r' % self._col_width_ratios
53+
width_arg = (', width_ratios=%r' % (self._col_width_ratios,)
5454
if self._col_width_ratios is not None else '')
5555
return '{clsname}({nrows}, {ncols}{optionals})'.format(
5656
clsname=self.__class__.__name__,

lib/matplotlib/tests/test_gridspec.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,11 @@ def test_height_ratios():
2424
"""
2525
with pytest.raises(ValueError):
2626
gridspec.GridSpec(1, 1, height_ratios=[2, 1, 3])
27+
28+
29+
def test_repr():
30+
ss = gridspec.GridSpec(2, 2,
31+
height_ratios=(3, 1),
32+
width_ratios=(1, 3))
33+
assert repr(ss) == \
34+
"GridSpec(2, 2, height_ratios=(3, 1), width_ratios=(1, 3))"

0 commit comments

Comments
 (0)
0