Skip to content

Commit c6e64b1

Browse files
committed
TST: 32bit dtype compat pandas-dev#36579
1 parent 4291973 commit c6e64b1

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

pandas/tests/indexes/period/test_indexing.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import pytest
66

77
from pandas._libs.tslibs import period as libperiod
8+
from pandas.compat import IS64
89
from pandas.errors import InvalidIndexError
910

1011
import pandas as pd
@@ -450,7 +451,8 @@ def test_get_indexer_non_unique(self):
450451

451452
result = idx1.get_indexer_non_unique(idx2)
452453
expected_indexer = np.array([1, 0, 2, -1, -1], dtype=np.intp)
453-
expected_missing = np.array([2, 3], dtype=np.int64)
454+
expected_dtype = np.int64 if IS64 else np.int32
455+
expected_missing = np.array([2, 3], dtype=expected_dtype)
454456

455457
tm.assert_numpy_array_equal(result[0], expected_indexer)
456458
tm.assert_numpy_array_equal(result[1], expected_missing)

pandas/tests/indexes/test_base.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import pandas._config.config as cf
1212

1313
from pandas._libs.tslib import Timestamp
14+
from pandas.compat import IS64
1415
from pandas.compat.numpy import np_datetime64_compat
1516
from pandas.util._test_decorators import async_mark
1617

@@ -2607,7 +2608,8 @@ def construct(dtype):
26072608
ex1 = np.array([0, 3, 1, 4, 2, 5] * 2, dtype=np.intp)
26082609
ex2 = np.array([], dtype=np.intp)
26092610
tm.assert_numpy_array_equal(result[0], ex1)
2610-
tm.assert_numpy_array_equal(result[1], ex2.astype(np.int64))
2611+
expected_dtype = np.int64 if IS64 else np.int32
2612+
tm.assert_numpy_array_equal(result[1], ex2.astype(expected_dtype))
26112613

26122614
else:
26132615
no_matches = np.array([-1] * 6, dtype=np.intp)

pandas/tests/test_algos.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,8 @@ def test_lookup_nan(self, writable):
15451545
xs.setflags(write=writable)
15461546
m = ht.Float64HashTable()
15471547
m.map_locations(xs)
1548-
tm.assert_numpy_array_equal(m.lookup(xs), np.arange(len(xs), dtype=np.int64))
1548+
expected_dtype = np.int64 if IS64 else np.int32
1549+
tm.assert_numpy_array_equal(m.lookup(xs), np.arange(len(xs), dtype=expected_dtype))
15491550

15501551
def test_add_signed_zeros(self):
15511552
# GH 21866 inconsistent hash-function for float64
@@ -1578,7 +1579,8 @@ def test_lookup_overflow(self, writable):
15781579
xs.setflags(write=writable)
15791580
m = ht.UInt64HashTable()
15801581
m.map_locations(xs)
1581-
tm.assert_numpy_array_equal(m.lookup(xs), np.arange(len(xs), dtype=np.int64))
1582+
expected_dtype = np.int64 if IS64 else np.int32
1583+
tm.assert_numpy_array_equal(m.lookup(xs), np.arange(len(xs), dtype=expected_dtype))
15821584

15831585
def test_get_unique(self):
15841586
s = Series([1, 2, 2 ** 63, 2 ** 63], dtype=np.uint64)

0 commit comments

Comments
 (0)