8000 TST: fix the tests · matplotlib/matplotlib@3488f10 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3488f10

Browse files
committed
TST: fix the tests
1 parent 0810891 commit 3488f10

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7087,19 +7087,6 @@ def test_axis_extent_arg2():
70877087
assert (ymin, ymax) == ax.get_ylim()
70887088

70897089

7090-
def test_datetime_masked():
7091-
# make sure that all-masked data falls back to the viewlim
7092-
# set in convert.axisinfo....
7093-
x = np.array([datetime.datetime(2017, 1, n) for n in range(1, 6)])
7094-
y = np.array([1, 2, 3, 4, 5])
7095-
m = np.ma.masked_greater(y, 0)
7096-
7097-
fig, ax = plt.subplots()
7098-
ax.plot(x, m)
7099-
dt = mdates.date2num(np.datetime64('0000-12-31'))
7100-
assert ax.get_xlim() == (730120.0 + dt, 733773.0 + dt)
7101-
7102-
71037090
def test_hist_auto_bins():
71047091
_, bins, _ = plt.hist([[1, 2, 3], [3, 4, 5, 6]], bins='auto')
71057092
assert bins[0] <= 1

lib/matplotlib/tests/test_dates.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,17 @@ def test_date_empty():
7777
ax.xaxis_date()
7878
fig.draw_without_rendering()
7979
np.testing.assert_allclose(ax.get_xlim(),
80-
[mdates.date2num(np.datetime64('2000-01-01')),
81-
mdates.date2num(np.datetime64('2010-01-01'))])
80+
[mdates.date2num(np.datetime64('1970-01-01')),
81+
mdates.date2num(np.datetime64('1970-01-02'))])
8282

8383
mdates._reset_epoch_test_example()
8484
mdates.set_epoch('0000-12-31')
8585
fig, ax = plt.subplots()
8686
ax.xaxis_date()
8787
fig.draw_without_rendering()
8888
np.testing.assert_allclose(ax.get_xlim(),
89-
[mdates.date2num(np.datetime64('2000-01-01')),
90-
mdates.date2num(np.datetime64('2010-01-01'))])
89+
[mdates.date2num(np.datetime64('1970-01-01')),
90+
mdates.date2num(np.datetime64('1970-01-02'))])
9191
mdates._reset_epoch_test_example()
9292

9393

@@ -1235,7 +1235,7 @@ def test_julian2num():
12351235
def test_DateLocator():
12361236
locator = mdates.DateLocator()
12371237
# Test nonsingular
1238-
assert locator.nonsingular(0, np.inf) == (10957.0, 14610.0)
1238+
assert locator.nonsingular(0, np.inf) == (0, 1)
12391239
assert locator.nonsingular(0, 1) == (0, 1)
12401240
assert locator.nonsingular(1, 0) == (0, 1)
12411241
assert locator.nonsingular(0, 0) == (-2, 2)
@@ -1328,3 +1328,15 @@ def test_usetex_newline():
13281328
fig, ax = plt.subplots()
13291329
ax.xaxis.set_major_formatter(mdates.DateFormatter('%d/%m\n%Y'))
13301330
fig.canvas.draw()
1331+
1332+
1333+
def test_datetime_masked():
1334+
# make sure that all-masked data falls back to the viewlim
1335+
# set in convert.axisinfo....
1336+
x = np.array([datetime.datetime(2017, 1, n) for n in range(1, 6)])
1337+
y = np.array([1, 2, 3, 4, 5])
1338+
m = np.ma.masked_greater(y, 0)
1339+
1340+
fig, ax = plt.subplots()
1341+
ax.plot(x, m)
1342+
assert ax.get_xlim() == (0, 1)

0 commit comments

Comments
 (0)
0