Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7cf7368

Browse files
timhoffmmeeseeksmachine
authored andcommitted
Backport PR #20817: Make test_change_epoch more robust.
1 parent 7d5754e commit 7cf7368

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/tests/test_dates.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,12 +1004,15 @@ def test_datetime64_in_list():
10041004
def test_change_epoch():
10051005
date = np.datetime64('2000-01-01')
10061006

1007+
# use private method to clear the epoch and allow it to be set...
1008+
mdates._reset_epoch_test_example()
1009+
mdates.get_epoch() # Set default.
1010+
10071011
with pytest.raises(RuntimeError):
10081012
# this should fail here because there is a sentinel on the epoch
10091013
# if the epoch has been used then it cannot be set.
10101014
mdates.set_epoch('0000-01-01')
10111015

1012-
# use private method to clear the epoch and allow it to be set...
10131016
mdates._reset_epoch_test_example()
10141017
mdates.set_epoch('1970-01-01')
10151018
dt = (date - np.datetime64('1970-01-01')).astype('datetime64[D]')

0 commit comments

Comments
 (0)