Fix test failures on 32-bit systems
authorDebian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Tue, 31 Jan 2023 13:21:16 +0000 (13:21 +0000)
committerPeter Michael Green <plugwash@raspbian.org>
Tue, 31 Jan 2023 13:21:16 +0000 (13:21 +0000)
Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Bug-Debian: partly https://bugs.debian.org/1026351
Forwarded: no

Gbp-Pq: Name tests_dont_assume_64bit.patch

pandas/core/arrays/_ranges.py
pandas/tests/frame/test_stack_unstack.py
pandas/tests/reshape/test_pivot.py
pandas/tests/series/methods/test_round.py
pandas/tests/test_downstream.py
pandas/tests/test_sorting.py

index 3bef3e59d5687aecbbb981e0d7d49e7c19ab7d51..07fefa903860bb5e1db23dcd7bdc319e19c9a7b2 100644 (file)
@@ -162,9 +162,7 @@ def _generate_range_overflow_safe_signed(
                 # Putting this into a DatetimeArray/TimedeltaArray
                 #  would incorrectly be interpreted as NaT
                 raise OverflowError
-            # error: Incompatible return value type (got "signedinteger[_64Bit]",
-            # expected "int")
-            return result  # type: ignore[return-value]
+            return int(result)
         except (FloatingPointError, OverflowError):
             # with endpoint negative and addend positive we risk
             #  FloatingPointError; with reversed signed we risk OverflowError
@@ -185,9 +183,7 @@ def _generate_range_overflow_safe_signed(
             i64max = np.uint64(i8max)
             assert result > i64max
             if result <= i64max + np.uint64(stride):
-                # error: Incompatible return value type (got "unsignedinteger", expected
-                # "int")
-                return result  # type: ignore[return-value]
+                return int(result)
 
     raise OutOfBoundsDatetime(
         f"Cannot generate range with {side}={endpoint} and periods={periods}"
index e22559802cbeca51920736481900e584894bd90f..101e1b60e2c02eed92fefd9bf19c44419add5d5b 100644 (file)
@@ -1,6 +1,7 @@
 from datetime import datetime
 from io import StringIO
 import itertools
+import sys
 
 import numpy as np
 import pytest
@@ -1862,6 +1863,7 @@ Thu,Lunch,Yes,51.51,17"""
         tm.assert_frame_equal(recons, df)
 
     @pytest.mark.slow
+    @pytest.mark.xfail(condition=sys.maxsize<2**33, reason="assumes default int is int64", strict=False)
     def test_unstack_number_of_levels_larger_than_int32(self, monkeypatch):
         # GH#20601
         # GH 26314: Change ValueError to PerformanceWarning
index 416ff104b4caebe474eb9d980e915741ec649660..909c4e0c37e77d8c71cb423ca1316e5eee8f3d2e 100644 (file)
@@ -4,6 +4,7 @@ from datetime import (
     timedelta,
 )
 from itertools import product
+import sys
 
 import numpy as np
 import pytest
@@ -2018,6 +2019,7 @@ class TestPivotTable:
         tm.assert_frame_equal(result, expected)
 
     @pytest.mark.slow
+    @pytest.mark.xfail(condition=sys.maxsize<2**33, reason="assumes default int is int64", strict=False)
     def test_pivot_number_of_levels_larger_than_int32(self, monkeypatch):
         # GH 20601
         # GH 26314: Change ValueError to PerformanceWarning
index 6c40e3641955122079e93007ce3d162ce66a7976..5882030b917fa2c1ce69069cf5e706ac81dc9bc0 100644 (file)
@@ -30,8 +30,7 @@ class TestSeriesRound:
     def test_round_numpy_with_nan(self, any_float_dtype):
         # See GH#14197
         ser = Series([1.53, np.nan, 0.06], dtype=any_float_dtype)
-        with tm.assert_produces_warning(None):
-            result = ser.round()
+        result = ser.round() # on armhf, numpy warns
         expected = Series([2.0, np.nan, 0.0], dtype=any_float_dtype)
         tm.assert_series_equal(result, expected)
 
index 224f4b5bf82add9e546dc96744e6306cfae3fbbd..067eb85d8efe7075bb1d45a86404e2a864bd4d57 100644 (file)
@@ -311,7 +311,7 @@ def test_missing_required_dependency():
     for name in ["numpy", "pytz", "dateutil"]:
         assert name in output
 
-
+@pytest.mark.xfail(condition=sys.maxsize<2**33, reason="different nativesize-int vs int64 type rules", strict=False)
 def test_frame_setitem_dask_array_into_new_col():
     # GH#47128
 
index 537792ea8263c9155a901b6e53cce4facd4ef909..dd5839cedb4e2ff86ba8872ceb340230bd9a4782 100644 (file)
@@ -29,6 +29,7 @@ from pandas.core.sorting import (
     lexsort_indexer,
     nargsort,
 )
+import sys
 
 
 @pytest.fixture
@@ -226,6 +227,7 @@ class TestSorting:
         tm.assert_numpy_array_equal(result, np.array(exp), check_dtype=False)
 
 
+@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
 class TestMerge:
     def test_int64_overflow_outer_merge(self):
         # #2690, combinatorial explosion