3986302
From a7a17abcd9f03651ae07a0aa138668fd49287466 Mon Sep 17 00:00:00 2001
3986302
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
3986302
Date: Fri, 25 Nov 2022 09:06:56 -0500
3986302
Subject: [PATCH] TST: Fix some little-endian assumptions
3986302
3986302
See previous PR#46681.
3986302
---
3986302
 pandas/tests/arrays/floating/test_arithmetic.py  |  2 +-
3986302
 pandas/tests/frame/methods/test_to_records.py    | 14 ++++++++++++--
3986302
 pandas/tests/scalar/timedelta/test_arithmetic.py |  2 +-
3986302
 3 files changed, 14 insertions(+), 4 deletions(-)
3986302
3986302
diff --git a/pandas/tests/arrays/floating/test_arithmetic.py b/pandas/tests/arrays/floating/test_arithmetic.py
3986302
index ec7419d6346a8..fdf2b00bdbac1 100644
3986302
--- a/pandas/tests/arrays/floating/test_arithmetic.py
3986302
+++ b/pandas/tests/arrays/floating/test_arithmetic.py
3986302
@@ -162,7 +162,7 @@ def test_error_invalid_values(data, all_arithmetic_operators):
3986302
             "not all arguments converted during string formatting",
3986302
             "can't multiply sequence by non-int of type 'float'",
3986302
             "ufunc 'subtract' cannot use operands with types dtype",
3986302
-            r"ufunc 'add' cannot use operands with types dtype\('
3986302
+            rf"ufunc 'add' cannot use operands with types dtype\('{tm.ENDIAN}M8\[ns\]'\)",
3986302
             r"ufunc 'add' cannot use operands with types dtype\('float\d{2}'\)",
3986302
             "cannot subtract DatetimeArray from ndarray",
3986302
         ]
3986302
diff --git a/pandas/tests/frame/methods/test_to_records.py b/pandas/tests/frame/methods/test_to_records.py
3986302
index 32cccddc9d515..701063c277226 100644
3986302
--- a/pandas/tests/frame/methods/test_to_records.py
3986302
+++ b/pandas/tests/frame/methods/test_to_records.py
3986302
@@ -96,7 +96,13 @@ def test_to_records_index_name(self):
3986302
             + [np.asarray(df.iloc[:, i]) for i in range(3)],
3986302
             dtype={
3986302
                 "names": ["A", "level_1", "0", "1", "2"],
3986302
-                "formats": ["O", "O", "
3986302
+                "formats": [
3986302
+                    "O",
3986302
+                    "O",
3986302
+                    f"{tm.ENDIAN}f8",
3986302
+                    f"{tm.ENDIAN}f8",
3986302
+                    f"{tm.ENDIAN}f8",
3986302
+                ],
3986302
             },
3986302
         )
3986302
         tm.assert_numpy_array_equal(result, expected)
3986302
@@ -123,7 +129,11 @@ def test_to_records_index_dtype(self):
3986302
                 ("2022-01-01", "2022-01-01", "2022-01-01"),
3986302
                 ("2022-01-02", "2022-01-02", "2022-01-02"),
3986302
             ],
3986302
-            dtype=[("1", "
3986302
+            dtype=[
3986302
+                ("1", f"{tm.ENDIAN}M8[ns]"),
3986302
+                ("2", f"{tm.ENDIAN}M8[ns]"),
3986302
+                ("3", f"{tm.ENDIAN}M8[ns]"),
3986302
+            ],
3986302
         )
3986302
 
3986302
         result = df.to_records(index=False)
3986302
diff --git a/pandas/tests/scalar/timedelta/test_arithmetic.py b/pandas/tests/scalar/timedelta/test_arithmetic.py
3986302
index 1c3868bc85fd5..526b558ecb813 100644
3986302
--- a/pandas/tests/scalar/timedelta/test_arithmetic.py
3986302
+++ b/pandas/tests/scalar/timedelta/test_arithmetic.py
3986302
@@ -435,7 +435,7 @@ def test_td_mul_td64_ndarray_invalid(self):
3986302
 
3986302
         msg = (
3986302
             "ufunc '?multiply'? cannot use operands with types "
3986302
-            r"dtype\('
3986302
+            rf"dtype\('{tm.ENDIAN}m8\[ns\]'\) and dtype\('{tm.ENDIAN}m8\[ns\]'\)"
3986302
         )
3986302
         with pytest.raises(TypeError, match=msg):
3986302
             td * other