Skip to content

Commit 6b8221c

Browse files
committed
TST: add datetime column to test
1 parent 87265bc commit 6b8221c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pandas/tests/frame/methods/test_to_dict.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,21 @@ def test_to_dict_wide(self):
259259
def test_to_dict_orient_dtype(self):
260260
# GH#22620
261261
# Input Data
262-
input_data = {"a": [1, 2, 3], "b": [1.0, 2.0, 3.0], "c": ["X", "Y", "Z"]}
262+
input_data = {
263+
"a": [1, 2, 3],
264+
"b": [1.0, 2.0, 3.0],
265+
"c": ["X", "Y", "Z"],
266+
"d": [datetime(2018, 1, 1), datetime(2019, 2, 2), datetime(2020, 3, 3)],
267+
}
263268
df = DataFrame(input_data)
264269
# Expected Dtypes
265-
expected = {"a": int, "b": float, "c": str}
270+
expected = {"a": int, "b": float, "c": str, "d": datetime}
266271
# Extracting dtypes out of to_dict operation
267272
for df_dict in df.to_dict("records"):
268273
result = {
269274
"a": type(df_dict["a"]),
270275
"b": type(df_dict["b"]),
271276
"c": type(df_dict["c"]),
277+
"d": type(df_dict["d"]),
272278
}
273279
assert result == expected

0 commit comments

Comments
 (0)