From: Debian Science Team Date: Wed, 11 Jan 2023 07:34:28 +0000 (+0000) Subject: Fix or skip tests that assume the wrong endianness X-Git-Tag: archive/raspbian/1.5.3+dfsg-2+rpi1~1^2^2~18 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ffbb6bad2920201541957502846dd1123cf87d23;p=pandas.git Fix or skip tests that assume the wrong endianness This is a bug in the tests not pandas itself - the expected values explicitly specify little-endian Author: Rebecca N. Palmer Forwarded: not-needed - upstream fix ad98c2b77 Gbp-Pq: Name tests_dont_assume_endian.patch --- diff --git a/pandas/tests/arrays/floating/test_arithmetic.py b/pandas/tests/arrays/floating/test_arithmetic.py index ec7419d6..bc9d8c01 100644 --- a/pandas/tests/arrays/floating/test_arithmetic.py +++ b/pandas/tests/arrays/floating/test_arithmetic.py @@ -162,7 +162,7 @@ def test_error_invalid_values(data, all_arithmetic_operators): "not all arguments converted during string formatting", "can't multiply sequence by non-int of type 'float'", "ufunc 'subtract' cannot use operands with types dtype", - r"ufunc 'add' cannot use operands with types dtype\(']M8\[ns\]'\)", r"ufunc 'add' cannot use operands with types dtype\('float\d{2}'\)", "cannot subtract DatetimeArray from ndarray", ] diff --git a/pandas/tests/frame/methods/test_to_records.py b/pandas/tests/frame/methods/test_to_records.py index 32cccddc..acd29ccf 100644 --- a/pandas/tests/frame/methods/test_to_records.py +++ b/pandas/tests/frame/methods/test_to_records.py @@ -12,6 +12,7 @@ from pandas import ( date_range, ) import pandas._testing as tm +from pandas.compat import is_platform_little_endian class TestDataFrameToRecords: @@ -96,7 +97,7 @@ class TestDataFrameToRecords: + [np.asarray(df.iloc[:, i]) for i in range(3)], dtype={ "names": ["A", "level_1", "0", "1", "2"], - "formats": ["O", "O", "f8", ">f8", ">f8"], }, ) tm.assert_numpy_array_equal(result, expected) @@ -123,7 +124,7 @@ class TestDataFrameToRecords: ("2022-01-01", "2022-01-01", "2022-01-01"), ("2022-01-02", "2022-01-02", "2022-01-02"), ], - dtype=[("1", "M8[ns]"), ("2", ">M8[ns]"), ("3", ">M8[ns]")], ) result = df.to_records(index=False) diff --git a/pandas/tests/scalar/timedelta/test_arithmetic.py b/pandas/tests/scalar/timedelta/test_arithmetic.py index f3b84388..d7ecd022 100644 --- a/pandas/tests/scalar/timedelta/test_arithmetic.py +++ b/pandas/tests/scalar/timedelta/test_arithmetic.py @@ -435,7 +435,7 @@ class TestTimedeltaMultiplicationDivision: msg = ( "ufunc '?multiply'? cannot use operands with types " - r"dtype\(']m8\[ns\]'\) and dtype\('[<>]m8\[ns\]'\)" ) with pytest.raises(TypeError, match=msg): td * other