From 2f243695b105a7346a0135bc7ac8d94812c22366 Mon Sep 17 00:00:00 2001 From: Debian Science Team Date: Thu, 9 Apr 2020 04:11:32 +0100 Subject: [PATCH] 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: no Gbp-Pq: Name tests_dont_assume_endian.patch --- pandas/tests/frame/test_convert_to.py | 4 ++++ pandas/tests/indexes/timedeltas/test_arithmetic.py | 2 +- pandas/tests/io/parser/test_c_parser_only.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pandas/tests/frame/test_convert_to.py b/pandas/tests/frame/test_convert_to.py index 3f0768ad..2e2776a1 100644 --- a/pandas/tests/frame/test_convert_to.py +++ b/pandas/tests/frame/test_convert_to.py @@ -15,6 +15,7 @@ from pandas import ( ) from pandas.tests.frame.common import TestData import pandas.util.testing as tm +from pandas.compat import is_platform_little_endian class TestDataFrameConvertTo(TestData): @@ -323,6 +324,7 @@ class TestDataFrameConvertTo(TestData): ), ], ) + @pytest.mark.xfail(condition=not is_platform_little_endian(),reason="expected values assume little-endian",strict=False) def test_to_records_dtype(self, kwargs, expected): # see gh-18146 df = DataFrame({"A": [1, 2], "B": [0.2, 1.5], "C": ["a", "bc"]}) @@ -396,11 +398,13 @@ class TestDataFrameConvertTo(TestData): ), ], ) + @pytest.mark.xfail(condition=not is_platform_little_endian(),reason="expected values assume little-endian",strict=False) def test_to_records_dtype_mi(self, df, kwargs, expected): # see gh-18146 result = df.to_records(**kwargs) tm.assert_almost_equal(result, expected) + @pytest.mark.xfail(condition=not is_platform_little_endian(),reason="expected values assume little-endian",strict=False) def test_to_records_dict_like(self): # see gh-18146 class DictLike: diff --git a/pandas/tests/indexes/timedeltas/test_arithmetic.py b/pandas/tests/indexes/timedeltas/test_arithmetic.py index 4544657f..0a939fdf 100644 --- a/pandas/tests/indexes/timedeltas/test_arithmetic.py +++ b/pandas/tests/indexes/timedeltas/test_arithmetic.py @@ -234,7 +234,7 @@ class TestTimedeltaIndexArithmetic: tm.assert_numpy_array_equal(np.array([2]) * td, expected) msg = ( "ufunc '?multiply'? cannot use operands with types" - r" dtype\(']m8\[ns\]'\) and dtype\('[<>]m8\[ns\]'\)" ) with pytest.raises(TypeError, match=msg): td * other diff --git a/pandas/tests/io/parser/test_c_parser_only.py b/pandas/tests/io/parser/test_c_parser_only.py index 77b52eb9..15d93b0d 100644 --- a/pandas/tests/io/parser/test_c_parser_only.py +++ b/pandas/tests/io/parser/test_c_parser_only.py @@ -129,7 +129,7 @@ nan 2 "the dtype timedelta64 is not supported for parsing", dict(dtype={"A": "timedelta64", "B": "float64"}), ), - ("the dtype ]U8 is not supported for parsing", dict(dtype={"A": "U8"})), ], ids=["dt64-0", "dt64-1", "td64", "