Skip to content

Commit

Permalink
TST: Add test_zero_copy_dictionaries
Browse files Browse the repository at this point in the history
  • Loading branch information
Licht-T authored and wesm committed Oct 27, 2017
1 parent e0561dc commit ddc6b84
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions python/pyarrow/tests/test_convert_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,19 @@ def test_zero_copy_success(self):
result = pa.array([0, 1, 2]).to_pandas(zero_copy_only=True)
npt.assert_array_equal(result, [0, 1, 2])

def test_zero_copy_dictionaries(self):
arr = pa.DictionaryArray.from_arrays(
np.array([0, 0]),
np.array(['A']))

result = arr.to_pandas(zero_copy_only=True)
values = pd.Categorical(['A', 'A'])

tm.assert_series_equal(
pd.Series(result),
pd.Series(values),
check_names=False)

def test_zero_copy_failure_on_object_types(self):
with pytest.raises(pa.ArrowException):
pa.array(['A', 'B', 'C']).to_pandas(zero_copy_only=True)
Expand Down

0 comments on commit ddc6b84

Please sign in to comment.