Skip to content

Commit

Permalink
Adjust tests in internals folder for arrow string option (#56140)
Browse files Browse the repository at this point in the history
  • Loading branch information
phofl authored Nov 26, 2023
1 parent 472516c commit 22d3c9c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pandas/tests/internals/test_internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ def test_astype(self, t):
else:
assert tmgr.iget(3).dtype.type == t

def test_convert(self):
def test_convert(self, using_infer_string):
def _compare(old_mgr, new_mgr):
"""compare the blocks, numeric compare ==, object don't"""
old_blocks = set(old_mgr.blocks)
Expand Down Expand Up @@ -626,9 +626,10 @@ def _compare(old_mgr, new_mgr):
mgr.iset(1, np.array(["2."] * N, dtype=np.object_))
mgr.iset(2, np.array(["foo."] * N, dtype=np.object_))
new_mgr = mgr.convert(copy=True)
assert new_mgr.iget(0).dtype == np.object_
assert new_mgr.iget(1).dtype == np.object_
assert new_mgr.iget(2).dtype == np.object_
dtype = "string[pyarrow_numpy]" if using_infer_string else np.object_
assert new_mgr.iget(0).dtype == dtype
assert new_mgr.iget(1).dtype == dtype
assert new_mgr.iget(2).dtype == dtype
assert new_mgr.iget(3).dtype == np.int64
assert new_mgr.iget(4).dtype == np.float64

Expand All @@ -639,9 +640,9 @@ def _compare(old_mgr, new_mgr):
mgr.iset(1, np.array(["2."] * N, dtype=np.object_))
mgr.iset(2, np.array(["foo."] * N, dtype=np.object_))
new_mgr = mgr.convert(copy=True)
assert new_mgr.iget(0).dtype == np.object_
assert new_mgr.iget(1).dtype == np.object_
assert new_mgr.iget(2).dtype == np.object_
assert new_mgr.iget(0).dtype == dtype
assert new_mgr.iget(1).dtype == dtype
assert new_mgr.iget(2).dtype == dtype
assert new_mgr.iget(3).dtype == np.int32
assert new_mgr.iget(4).dtype == np.bool_
assert new_mgr.iget(5).dtype.type, np.datetime64
Expand Down

0 comments on commit 22d3c9c

Please sign in to comment.