Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions pandas/tests/indexes/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,23 +915,12 @@ def test_format(self):
self._check_method_works(Index.format)

# GH 14626
# our formatting is different by definition when we have
# ms vs us precision (e.g. trailing zeros);
# so don't compare this case
def datetime_now_without_trailing_zeros():
now = datetime.now()

while str(now).endswith("000"):
now = datetime.now()

return now

index = Index([datetime_now_without_trailing_zeros()])

# windows has different precision on datetime.datetime.now (it doesn't
# include us since the default for Timestamp shows these but Index
# formating does not we are skipping
if not is_platform_windows():
# formating does not we are skipping)
now = datetime.now()
if not str(now).endswith("000"):
index = Index([now])
formatted = index.format()
expected = [str(index[0])]
self.assertEqual(formatted, expected)
Expand Down