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

Skip to content

Commit 986a0f9

Browse files
committed
Separate test
1 parent 4876bb5 commit 986a0f9

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

lib/matplotlib/dates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ def format_ticks(self, values):
777777
break
778778
elif level == 0:
779779
# all tickdate are the same, so only micros might be different
780-
# set to the most precise available (level=6: microseconds doesn't exist...)
780+
# set to the most precise (6: microseconds doesn't exist...)
781781
level = 5
782782

783783
# level is the basic level we will label at.

lib/matplotlib/tests/test_dates.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,14 @@ def _create_auto_date_locator(date1, date2):
449449
assert list(map(str, mdates.num2date(locator()))) == expected
450450

451451

452+
def test_concise_formatter_subsecond():
453+
locator = mdates.AutoDateLocator(interval_multiples=True)
454+
formatter = mdates.ConciseDateFormatter(locator)
455+
year_1996 = 9861.0
456+
strings = formatter.format_ticks([year_1996, year_1996 + 500 / mdates.MUSECONDS_PER_DAY, year_1996 + 900 / mdates.MUSECONDS_PER_DAY])
457+
assert strings == ['00:00', '00.0005', '00.0009']
458+
459+
452460
def test_concise_formatter():
453461
def _create_auto_date_locator(date1, date2):
454462
fig, ax = plt.subplots()

0 commit comments

Comments
 (0)