Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport PR #20817 on branch v3.4.x (Make test_change_epoch more robust.) #20823

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/matplotlib/tests/test_dates.py
Expand Up @@ -1004,12 +1004,15 @@ def test_datetime64_in_list():
def test_change_epoch():
date = np.datetime64('2000-01-01')

# use private method to clear the epoch and allow it to be set...
mdates._reset_epoch_test_example()
mdates.get_epoch() # Set default.

with pytest.raises(RuntimeError):
# this should fail here because there is a sentinel on the epoch
# if the epoch has been used then it cannot be set.
mdates.set_epoch('0000-01-01')

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