Skip to content

Commit 166ec23

Browse files
Inline datetime_now_without_trailing_zeros within test_format
1 parent 68a72a7 commit 166ec23

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pandas/tests/indexes/test_base.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,16 @@ def test_summary(self):
913913
def test_format(self):
914914
self._check_method_works(Index.format)
915915

916-
index = Index([self.datetime_now_without_trailing_zeros()])
916+
# GH 14626
917+
def datetime_now_without_trailing_zeros():
918+
now = datetime.now()
919+
920+
while str(now).endswith("000"):
921+
now = datetime.now()
922+
923+
return now
924+
925+
index = Index([datetime_now_without_trailing_zeros()])
917926

918927
# windows has different precision on datetime.datetime.now (it doesn't
919928
# include us since the default for Timestamp shows these but Index
@@ -937,15 +946,6 @@ def test_format(self):
937946

938947
self.strIndex[:0].format()
939948

940-
# GH 14626
941-
def datetime_now_without_trailing_zeros(self):
942-
now = datetime.now()
943-
944-
while str(now).endswith("000"):
945-
now = datetime.now()
946-
947-
return now
948-
949949
def test_format_with_name_time_info(self):
950950
# bug I fixed 12/20/2011
951951
inc = timedelta(hours=4)

0 commit comments

Comments
 (0)