Skip to content

Commit 68b5e69

Browse files
committed
TST: replace with assert_frame/series_equal
1 parent 6633145 commit 68b5e69

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

pandas/tests/io/pytables/test_store.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -4897,39 +4897,40 @@ def _constructor(self):
48974897
data = {"a": [1, 2], "b": [3, 4]}
48984898
sdf = SubDataFrame(data, dtype=np.intp)
48994899

4900-
expected = np.array([[1, 3], [2, 4]], dtype=np.intp)
4900+
expected = DataFrame(data, dtype=np.intp)
49014901

49024902
with ensure_clean_path("temp.h5") as path:
49034903
sdf.to_hdf(path, "df")
4904-
result = read_hdf(path, "df").values
4905-
tm.assert_numpy_array_equal(result, expected)
4904+
result = read_hdf(path, "df")
4905+
tm.assert_frame_equal(result, expected)
49064906

49074907
with ensure_clean_path("temp.h5") as path:
49084908
with HDFStore(path) as store:
49094909
store.put("df", sdf)
4910-
result = read_hdf(path, "df").values
4911-
tm.assert_numpy_array_equal(result, expected)
4910+
result = read_hdf(path, "df")
4911+
tm.assert_frame_equal(result, expected)
49124912

49134913
def test_supported_for_subclasses_series(self):
49144914
class SubSeries(Series):
49154915
@property
49164916
def _constructor(self):
49174917
return SubSeries
49184918

4919-
sser = SubSeries([1, 2, 3], dtype=np.intp)
4919+
data = [1, 2, 3]
4920+
sser = SubSeries(data, dtype=np.intp)
49204921

4921-
expected = np.array([1, 2, 3], dtype=np.intp)
4922+
expected = Series(data, dtype=np.intp)
49224923

49234924
with ensure_clean_path("temp.h5") as path:
49244925
sser.to_hdf(path, "ser")
4925-
result = read_hdf(path, "ser").values
4926-
tm.assert_numpy_array_equal(result, expected)
4926+
result = read_hdf(path, "ser")
4927+
tm.assert_series_equal(result, expected)
49274928

49284929
with ensure_clean_path("temp.h5") as path:
49294930
with HDFStore(path) as store:
49304931
store.put("ser", sser)
4931-
result = read_hdf(path, "ser").values
4932-
tm.assert_numpy_array_equal(result, expected)
4932+
result = read_hdf(path, "ser")
4933+
tm.assert_series_equal(result, expected)
49334934

49344935

49354936
@pytest.mark.parametrize("bad_version", [(1, 2), (1,), [], "12", "123"])

0 commit comments

Comments
 (0)