8000 Fix tests · matplotlib/matplotlib@67bde14 · GitHub
[go: up one dir, main page]

Skip to content

Commit 67bde14

Browse files
committed
Fix tests
1 parent 01ecaca commit 67bde14

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3123,7 +3123,7 @@ def set_xbound(self, lower=None, upper=None):
31233123
if upper is None and np.iterable(lower):
31243124
lower, upper = lower
31253125

3126-
old_lower, old_upper = self.get_xbound()
3126+
old_lower, old_upper = self.get_xbound(units=False)
31273127

31283128
if lower is None:
31293129
lower = old_lower
@@ -3165,7 +3165,6 @@ def get_xlim(self, units=True):
31653165
-----
31663166
The x-axis may be inverted, in which case the *left* value will
31673167
be greater than the *right* value.
3168-
31693168
"""
31703169
if units:
31713170
return self._convert_back_lim(self.viewLim.intervalx, self.xaxis)
@@ -3500,7 +3499,7 @@ def yaxis_inverted(self):
35003499
"""
35013500
return self.yaxis.get_inverted()
35023501

3503-
def get_ybound(self):
3502+
def get_ybound(self, units=True):
35043503
"""
35053504
Return the lower and upper y-axis bounds, in increasing order.
35063505
@@ -3515,7 +3514,7 @@ def get_ybound(self):
35153514
get_ylim, set_ylim
35163515
invert_yaxis, yaxis_inverted
35173516
"""
3518-
bottom, top = self.get_ylim()
3517+
bottom, top = self.get_ylim(units=units)
35193518
if bottom < top:
35203519
return bottom, top
35213520
else:
@@ -3543,7 +3542,7 @@ def set_ybound(self, lower=None, upper=None):
35433542
if upper is None and np.iterable(lower):
35443543
lower, upper = lower
35453544

3546-
old_lower, old_upper = self.get_ybound()
3545+
old_lower, old_upper = self.get_ybound(units=False)
35473546

35483547
if lower is None:
35493548
lower = old_lower

lib/matplotlib/tests/test_axes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6320,7 +6320,10 @@ def test_datetime_masked():
63206320
fig, ax = plt.subplots()
63216321
ax.plot(x, m)
63226322
# these are the default viewlim
6323-
assert ax.get_xlim() == (730120.0, 733773.0)
6323+
assert ax.get_xlim(units=False) == (730120.0, 733773.0)
6324+
assert (ax.get_xlim(units=True) ==
6325+
(datetime.datetime(2000, 1, 1, tzinfo=datetime.timezone.utc),
6326+
datetime.datetime(2010, 1, 1, tzinfo=datetime.timezone.utc)))
63246327

63256328

63266329
def test_hist_auto_bins():

0 commit comments

Comments
 (0)
0