Skip to content

Commit

Permalink
ARROW-7857: [Python] Revert temporary changes to pandas extension arr…
Browse files Browse the repository at this point in the history
…ay tests

Reverts #6614, now ARROW-7858 (casting extension type based on its storage type) is implemented.

Closes #6664 from jorisvandenbossche/ARROW-7857

Authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
jorisvandenbossche authored and kou committed Mar 21, 2020
1 parent 1884826 commit 0569da4
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions python/pyarrow/tests/test_pandas.py
Expand Up @@ -3651,14 +3651,11 @@ def test_conversion_extensiontype_to_extensionarray(monkeypatch):
arr = pa.ExtensionArray.from_storage(MyCustomIntegerType(), storage)
table = pa.table({'a': arr})

# TODO TEMP use our monkeypatched method for all pandas versions because
# latest pandas release / master fails to cast extension type to int64
# type (see ARROW-7857)
# if LooseVersion(pd.__version__) < "0.26.0.dev":
# ensure pandas Int64Dtype has the protocol method (for older pandas)
monkeypatch.setattr(
pd.Int64Dtype, '__from_arrow__', _Int64Dtype__from_arrow__,
raising=False)
if LooseVersion(pd.__version__) < "0.26.0.dev":
# ensure pandas Int64Dtype has the protocol method (for older pandas)
monkeypatch.setattr(
pd.Int64Dtype, '__from_arrow__', _Int64Dtype__from_arrow__,
raising=False)

# extension type points to Int64Dtype, which knows how to create a
# pandas ExtensionArray
Expand All @@ -3669,11 +3666,9 @@ def test_conversion_extensiontype_to_extensionarray(monkeypatch):

# monkeypatch pandas Int64Dtype to *not* have the protocol method
# (remove the version added above and the actual version for recent pandas)
# TODO TEMP see above
# if LooseVersion(pd.__version__) < "0.26.0.dev":
monkeypatch.delattr(pd.Int64Dtype, "__from_arrow__")
# else:
if LooseVersion(pd.__version__) >= "0.26.0.dev":
if LooseVersion(pd.__version__) < "0.26.0.dev":
monkeypatch.delattr(pd.Int64Dtype, "__from_arrow__")
else:
monkeypatch.delattr(
pd.core.arrays.integer._IntegerDtype, "__from_arrow__",
raising=False)
Expand Down

0 comments on commit 0569da4

Please sign in to comment.