diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py index 628095a2fcbd3..2dfeb7da07a3d 100644 --- a/pandas/tests/indexes/test_base.py +++ b/pandas/tests/indexes/test_base.py @@ -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)