Skip to content

Commit 6996de1

Browse files
arw2019JulianWgs
authored andcommitted
move pytables timezone aware tests from test_store.py -> test_timezone.py (pandas-dev#37060)
1 parent 6d7a118 commit 6996de1

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

pandas/tests/io/pytables/test_store.py

-23
Original file line numberDiff line numberDiff line change
@@ -2189,17 +2189,6 @@ def test_calendar_roundtrip_issue(self, setup_path):
21892189
result = store.select("table")
21902190
tm.assert_series_equal(result, s)
21912191

2192-
def test_roundtrip_tz_aware_index(self, setup_path):
2193-
# GH 17618
2194-
time = pd.Timestamp("2000-01-01 01:00:00", tz="US/Eastern")
2195-
df = pd.DataFrame(data=[0], index=[time])
2196-
2197-
with ensure_clean_store(setup_path) as store:
2198-
store.put("frame", df, format="fixed")
2199-
recons = store["frame"]
2200-
tm.assert_frame_equal(recons, df)
2201-
assert recons.index[0].value == 946706400000000000
2202-
22032192
def test_append_with_timedelta(self, setup_path):
22042193
# GH 3577
22052194
# append timedelta
@@ -2554,18 +2543,6 @@ def test_store_index_name(self, setup_path):
25542543
recons = store["frame"]
25552544
tm.assert_frame_equal(recons, df)
25562545

2557-
def test_store_index_name_with_tz(self, setup_path):
2558-
# GH 13884
2559-
df = pd.DataFrame({"A": [1, 2]})
2560-
df.index = pd.DatetimeIndex([1234567890123456787, 1234567890123456788])
2561-
df.index = df.index.tz_localize("UTC")
2562-
df.index.name = "foo"
2563-
2564-
with ensure_clean_store(setup_path) as store:
2565-
store.put("frame", df, format="table")
2566-
recons = store["frame"]
2567-
tm.assert_frame_equal(recons, df)
2568-
25692546
@pytest.mark.parametrize("table_format", ["table", "fixed"])
25702547
def test_store_index_name_numpy_str(self, table_format, setup_path):
25712548
# GH #13492

pandas/tests/io/pytables/test_timezones.py

+25
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,31 @@ def test_append_with_timezones_pytz(setup_path):
210210
tm.assert_frame_equal(result, df)
211211

212212

213+
def test_roundtrip_tz_aware_index(setup_path):
214+
# GH 17618
215+
time = pd.Timestamp("2000-01-01 01:00:00", tz="US/Eastern")
216+
df = pd.DataFrame(data=[0], index=[time])
217+
218+
with ensure_clean_store(setup_path) as store:
219+
store.put("frame", df, format="fixed")
220+
recons = store["frame"]
221+
tm.assert_frame_equal(recons, df)
222+
assert recons.index[0].value == 946706400000000000
223+
224+
225+
def test_store_index_name_with_tz(setup_path):
226+
# GH 13884
227+
df = pd.DataFrame({"A": [1, 2]})
228+
df.index = pd.DatetimeIndex([1234567890123456787, 1234567890123456788])
229+
df.index = df.index.tz_localize("UTC")
230+
df.index.name = "foo"
231+
232+
with ensure_clean_store(setup_path) as store:
233+
store.put("frame", df, format="table")
234+
recons = store["frame"]
235+
tm.assert_frame_equal(recons, df)
236+
237+
213238
def test_tseries_select_index_column(setup_path):
214239
# GH7777
215240
# selecting a UTC datetimeindex column did

0 commit comments

Comments
 (0)