Skip to content

TST: 32bit dtype compat #36579 #36584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pandas/tests/indexes/period/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pytest

from pandas._libs.tslibs import period as libperiod
from pandas.compat import IS64
from pandas.errors import InvalidIndexError

import pandas as pd
Expand Down Expand Up @@ -450,7 +451,8 @@ def test_get_indexer_non_unique(self):

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

tm.assert_numpy_array_equal(result[0], expected_indexer)
tm.assert_numpy_array_equal(result[1], expected_missing)
Expand Down
4 changes: 3 additions & 1 deletion pandas/tests/indexes/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import pandas._config.config as cf

from pandas._libs.tslib import Timestamp
from pandas.compat import IS64
from pandas.compat.numpy import np_datetime64_compat
from pandas.util._test_decorators import async_mark

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

else:
no_matches = np.array([-1] * 6, dtype=np.intp)
Expand Down
10 changes: 8 additions & 2 deletions pandas/tests/test_algos.py
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,10 @@ def test_lookup_nan(self, writable):
xs.setflags(write=writable)
m = ht.Float64HashTable()
m.map_locations(xs)
tm.assert_numpy_array_equal(m.lookup(xs), np.arange(len(xs), dtype=np.int64))
expected_dtype = np.int64 if IS64 else np.int32
tm.assert_numpy_array_equal(
m.lookup(xs), np.arange(len(xs), dtype=expected_dtype)
)

def test_add_signed_zeros(self):
# GH 21866 inconsistent hash-function for float64
Expand Down Expand Up @@ -1578,7 +1581,10 @@ def test_lookup_overflow(self, writable):
xs.setflags(write=writable)
m = ht.UInt64HashTable()
m.map_locations(xs)
tm.assert_numpy_array_equal(m.lookup(xs), np.arange(len(xs), dtype=np.int64))
expected_dtype = np.int64 if IS64 else np.int32
tm.assert_numpy_array_equal(
m.lookup(xs), np.arange(len(xs), dtype=expected_dtype)
)

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