Skip to content

Commit 784fbb4

Browse files
Debian Science Teamrebecca-palmer
Debian Science Team
authored andcommitted
Fix test failures on 32-bit systems
Author: Rebecca N. Palmer <[email protected]> Bug-Debian: partly https://bugs.debian.org/1026351 Forwarded: no Gbp-Pq: Name tests_dont_assume_64bit.patch
1 parent 6fd7bb5 commit 784fbb4

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

pandas/core/arrays/_ranges.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,7 @@ def _generate_range_overflow_safe_signed(
162162
# Putting this into a DatetimeArray/TimedeltaArray
163163
# would incorrectly be interpreted as NaT
164164
raise OverflowError
165-
# error: Incompatible return value type (got "signedinteger[_64Bit]",
166-
# expected "int")
167-
return result # type: ignore[return-value]
165+
return int(result)
168166
except (FloatingPointError, OverflowError):
169167
# with endpoint negative and addend positive we risk
170168
# FloatingPointError; with reversed signed we risk OverflowError
@@ -185,9 +183,7 @@ def _generate_range_overflow_safe_signed(
185183
i64max = np.uint64(i8max)
186184
assert result > i64max
187185
if result <= i64max + np.uint64(stride):
188-
# error: Incompatible return value type (got "unsignedinteger", expected
189-
# "int")
190-
return result # type: ignore[return-value]
186+
return int(result)
191187

192188
raise OutOfBoundsDatetime(
193189
f"Cannot generate range with {side}={endpoint} and periods={periods}"

pandas/tests/frame/test_stack_unstack.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from datetime import datetime
22
from io import StringIO
33
import itertools
4+
import sys
45

56
import numpy as np
67
import pytest
@@ -1862,6 +1863,7 @@ def test_unstack_unobserved_keys(self):
18621863
tm.assert_frame_equal(recons, df)
18631864

18641865
@pytest.mark.slow
1866+
@pytest.mark.xfail(condition=sys.maxsize<2**33, reason="assumes default int is int64", strict=False)
18651867
def test_unstack_number_of_levels_larger_than_int32(self, monkeypatch):
18661868
# GH#20601
18671869
# GH 26314: Change ValueError to PerformanceWarning

pandas/tests/reshape/test_pivot.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
timedelta,
55
)
66
from itertools import product
7+
import sys
78

89
import numpy as np
910
import pytest
@@ -2018,6 +2019,7 @@ def test_pivot_string_func_vs_func(self, f, f_numpy):
20182019
tm.assert_frame_equal(result, expected)
20192020

20202021
@pytest.mark.slow
2022+
@pytest.mark.xfail(condition=sys.maxsize<2**33, reason="assumes default int is int64", strict=False)
20212023
def test_pivot_number_of_levels_larger_than_int32(self, monkeypatch):
20222024
# GH 20601
20232025
# GH 26314: Change ValueError to PerformanceWarning

pandas/tests/series/methods/test_round.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ def test_round_numpy(self, any_float_dtype):
3030
def test_round_numpy_with_nan(self, any_float_dtype):
3131
# See GH#14197
3232
ser = Series([1.53, np.nan, 0.06], dtype=any_float_dtype)
33-
with tm.assert_produces_warning(None):
34-
result = ser.round()
33+
result = ser.round() # on armhf, numpy warns
3534
expected = Series([2.0, np.nan, 0.0], dtype=any_float_dtype)
3635
tm.assert_series_equal(result, expected)
3736

pandas/tests/test_downstream.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def test_missing_required_dependency():
311311
for name in ["numpy", "pytz", "dateutil"]:
312312
assert name in output
313313

314-
314+
@pytest.mark.xfail(condition=sys.maxsize<2**33, reason="different nativesize-int vs int64 type rules", strict=False)
315315
def test_frame_setitem_dask_array_into_new_col():
316316
# GH#47128
317317

pandas/tests/test_sorting.py

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
lexsort_indexer,
3030
nargsort,
3131
)
32+
import sys
3233

3334

3435
@pytest.fixture
@@ -226,6 +227,7 @@ def test_nargsort(self, ascending, na_position, exp, box):
226227
tm.assert_numpy_array_equal(result, np.array(exp), check_dtype=False)
227228

228229

230+
@pytest.mark.xfail(condition=sys.maxsize<2**33, reason="assumes default int is int64", strict=False)#used to be just the first one but that's been split into several
229231
class TestMerge:
230232
def test_int64_overflow_outer_merge(self):
231233
# #2690, combinatorial explosion

0 commit comments

Comments
 (0)