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

Skip to content

Commit 2fafd12

Browse files
committed
Add test for timedelta --> ordinalf conversion
1 parent f64e676 commit 2fafd12

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/matplotlib/tests/test_dates.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,3 +466,10 @@ def test_tz_utc():
466466
def test_num2timedelta(x, tdelta):
467467
dt = mdates.num2timedelta(x)
468468
assert dt == tdelta
469+
470+
471+
def test_timedelta_ordinalf():
472+
# Check that timedeltas can be converted to ordinalfs
473+
dt = datetime.timedelta(seconds=60)
474+
ordinalf = mdates._to_ordinalf(dt)
475+
assert ordinalf == 1 / (24 * 60)

0 commit comments

Comments
 (0)