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

Skip to content

Commit 6c1a79d

Browse files
committed
TST: re-add test
1 parent f1ad1f1 commit 6c1a79d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/matplotlib/tests/test_dates.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import matplotlib.pyplot as plt
1212
from matplotlib.testing.decorators import image_comparison
1313
import matplotlib.ticker as mticker
14+
import matplotlib._api as _api
1415

1516

1617
def test_date_numpyx():
@@ -1090,3 +1091,16 @@ def test_julian2num():
10901091
mdates.set_epoch('1970-01-01T00:00:00')
10911092
assert mdates.julian2num(2440588.5) == 1.0
10921093
assert mdates.num2julian(2.0) == 2440589.5
1094+
1095+
1096+
def test_epoch2num():
1097+
with _api.suppress_matplotlib_deprecation_warning():
1098+
mdates._reset_epoch_test_example()
1099+
mdates.set_epoch('0000-12-31')
1100+
assert mdates.epoch2num(86400) == 719164.0
1101+
assert mdates.num2epoch(719165.0) == 86400 * 2
1102+
# set back to the default
1103+
mdates._reset_epoch_test_example()
1104+
mdates.set_epoch('1970-01-01T00:00:00')
1105+
assert mdates.epoch2num(86400) == 1.0
1106+
assert mdates.num2epoch(2.0) == 86400 * 2

0 commit comments

Comments
 (0)