Skip to content

Commit b74894a

Browse files
committed
TST: use np.intp pandas-dev#36579
1 parent aa61db3 commit b74894a

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

pandas/tests/indexes/period/test_indexing.py

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

77
from pandas._libs.tslibs import period as libperiod
8-
from pandas.compat import IS64
98
from pandas.errors import InvalidIndexError
109

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

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

457455
tm.assert_numpy_array_equal(result[0], expected_indexer)
458456
tm.assert_numpy_array_equal(result[1], expected_missing)

pandas/tests/indexes/test_base.py

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

1313
from pandas._libs.tslib import Timestamp
14-
from pandas.compat import IS64
1514
from pandas.compat.numpy import np_datetime64_compat
1615
from pandas.util._test_decorators import async_mark
1716

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

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

pandas/tests/test_algos.py

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

15531550
def test_add_signed_zeros(self):
15541551
# GH 21866 inconsistent hash-function for float64
@@ -1581,10 +1578,7 @@ def test_lookup_overflow(self, writable):
15811578
xs.setflags(write=writable)
15821579
m = ht.UInt64HashTable()
15831580
m.map_locations(xs)
1584-
expected_dtype = np.int64 if IS64 else np.int32
1585-
tm.assert_numpy_array_equal(
1586-
m.lookup(xs), np.arange(len(xs), dtype=expected_dtype)
1587-
)
1581+
tm.assert_numpy_array_equal(m.lookup(xs), np.arange(len(xs), dtype=np.intp))
15881582

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

0 commit comments

Comments
 (0)