Skip to content

Commit

Permalink
TST: Add test for to_dict converting masked to python types (#50874)
Browse files Browse the repository at this point in the history
  • Loading branch information
phofl authored Jan 20, 2023
1 parent bf76acc commit da2b086
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pandas/tests/frame/methods/test_to_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,3 +485,13 @@ def test_to_dict_na_to_none(self, orient, expected):
df = DataFrame({"a": [1, NA]}, dtype="Int64")
result = df.to_dict(orient=orient)
assert result == expected

def test_to_dict_masked_native_python(self):
# GH#34665
df = DataFrame({"a": Series([1, 2], dtype="Int64"), "B": 1})
result = df.to_dict(orient="records")
assert type(result[0]["a"]) is int

df = DataFrame({"a": Series([1, NA], dtype="Int64"), "B": 1})
result = df.to_dict(orient="records")
assert type(result[0]["a"]) is int

0 comments on commit da2b086

Please sign in to comment.