Skip to content

Commit fba6973

Browse files
committed
Fix tests
1 parent 7b911c2 commit fba6973

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/matplotlib/axes/_base.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -3045,7 +3045,7 @@ def set_xbound(self, lower=None, upper=None):
30453045
if upper is None and np.iterable(lower):
30463046
lower, upper = lower
30473047

3048-
old_lower, old_upper = self.get_xbound()
3048+
old_lower, old_upper = self.get_xbound(units=False)
30493049

30503050
if lower is None:
30513051
lower = old_lower
@@ -3087,7 +3087,6 @@ def get_xlim(self, units=True):
30873087
-----
30883088
The x-axis may be inverted, in which case the *left* value will
30893089
be greater than the *right* value.
3090-
30913090
"""
30923091
if units:
30933092
return self._convert_back_lim(self.viewLim.intervalx, self.xaxis)
@@ -3425,7 +3424,7 @@ def yaxis_inverted(self):
34253424
"""
34263425
return self.yaxis.get_inverted()
34273426

3428-
def get_ybound(self):
3427+
def get_ybound(self, units=True):
34293428
"""
34303429
Return the lower and upper y-axis bounds, in increasing order.
34313430
@@ -3440,7 +3439,7 @@ def get_ybound(self):
34403439
get_ylim, set_ylim
34413440
invert_yaxis, yaxis_inverted
34423441
"""
3443-
bottom, top = self.get_ylim()
3442+
bottom, top = self.get_ylim(units=units)
34443443
if bottom < top:
34453444
return bottom, top
34463445
else:
@@ -3468,7 +3467,7 @@ def set_ybound(self, lower=None, upper=None):
34683467
if upper is None and np.iterable(lower):
34693468
lower, upper = lower
34703469

3471-
old_lower, old_upper = self.get_ybound()
3470+
old_lower, old_upper = self.get_ybound(units=False)
34723471

34733472
if lower is None:
34743473
lower = old_lower

lib/matplotlib/tests/test_axes.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -6471,7 +6471,10 @@ def test_datetime_masked():
64716471
fig, ax = plt.subplots()
64726472
ax.plot(x, m)
64736473
# these are the default viewlim
6474-
assert ax.get_xlim() == (730120.0, 733773.0)
6474+
assert ax.get_xlim(units=False) == (730120.0, 733773.0)
6475+
assert (ax.get_xlim(units=True) ==
6476+
(datetime.datetime(2000, 1, 1, tzinfo=datetime.timezone.utc),
6477+
datetime.datetime(2010, 1, 1, tzinfo=datetime.timezone.utc)))
64756478

64766479

64776480
def test_hist_auto_bins():

0 commit comments

Comments
 (0)