Skip to content

Commit 283932c

Browse files
add test
1 parent 92781f5 commit 283932c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tests/base/test_constructors.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,14 @@ def test_constructor_datetime_nonns(self, constructor):
179179
arr.flags.writeable = False
180180
result = constructor(arr)
181181
tm.assert_equal(result, expected)
182+
183+
def test_constructor_from_dict_keys(self, constructor, using_infer_string):
184+
# https://github.com/pandas-dev/pandas/issues/60343
185+
d = {"a": 1, "b": 2}
186+
result = constructor(d.keys(), dtype="str")
187+
if using_infer_string:
188+
assert result.dtype == "str"
189+
else:
190+
assert result.dtype == "object"
191+
expected = constructor(list(d.keys()), dtype="str")
192+
tm.assert_equal(result, expected)

0 commit comments

Comments
 (0)