Fix or skip tests that assume the wrong endianness
authorDebian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Sun, 28 Jun 2020 20:47:22 +0000 (21:47 +0100)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Sun, 28 Jun 2020 20:47:22 +0000 (21:47 +0100)
This is a bug in the tests not pandas itself -
the expected values explicitly specify little-endian

Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Forwarded: no

Gbp-Pq: Name tests_dont_assume_endian.patch

pandas/tests/frame/test_convert_to.py
pandas/tests/indexes/timedeltas/test_arithmetic.py
pandas/tests/io/parser/test_c_parser_only.py

index 3f0768ad5bdac9cf24afc4b3b6d56bfbce2bdeb4..2e2776a133437809c9332fcc60f501160744af2e 100644 (file)
@@ -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:
index 4544657f79af77a084f34115032237669408c9b6..0a939fdfd7494fedbd5a8f568031659d9f19a86b 100644 (file)
@@ -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\]'\)"
+            r" dtype\('[<>]m8\[ns\]'\) and dtype\('[<>]m8\[ns\]'\)"
         )
         with pytest.raises(TypeError, match=msg):
             td * other
index 77b52eb90d61fc277e2c98358b7668f55d1d7864..15d93b0d51559416ca3a64c8d0ea46c6ae64bcfa 100644 (file)
@@ -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"})),
+        ("the dtype [<>]U8 is not supported for parsing", dict(dtype={"A": "U8"})),
     ],
     ids=["dt64-0", "dt64-1", "td64", "<U8"],
 )