Skip to content

Commit

Permalink
PY2 div / int compat
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed May 22, 2018
1 parent 2e30a9c commit 9b0ccea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pandas/tests/extension/integer/test_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pytest

from pandas.tests.extension import base
from pandas.api.types import is_integer

from pandas.core.arrays import (
to_integer_array,
Expand Down Expand Up @@ -144,7 +145,7 @@ def compare(self, s, op, other):
expected = getattr(rs, op)(other)

# truediv can make infs
if 'truediv' in op:
if op in ['__truediv__', '__rtruediv__', '__rdiv__', '__div__']:
fill_value = np.nan
else:
fill_value = 0
Expand Down Expand Up @@ -359,6 +360,10 @@ def test_conversions(data_missing):
for r, e in zip(result, expected):
if pd.isnull(r):
assert pd.isnull(e)
elif is_integer(r):
# PY2 can be int or long
assert r == e
assert is_integer(e)
else:
assert r == e
assert type(r) == type(e)
Expand Down

0 comments on commit 9b0ccea

Please sign in to comment.