Blame SOURCES/0004-TST-Fix-test_str_encode-on-big-endian-machines.patch

4898f3
From 311c7a70a37d35cbbdc36f74dd306e4de0b7d78b Mon Sep 17 00:00:00 2001
4898f3
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
4898f3
Date: Mon, 12 Feb 2024 23:34:02 -0500
4898f3
Subject: [PATCH 4/6] TST: Fix test_str_encode on big endian machines
4898f3
4898f3
I couldn't find a way to specify the endianness when creating the
4898f3
`ArrowDtype`, so just pick the right result based on native byte order.
4898f3
4898f3
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
4898f3
---
4898f3
 pandas/tests/extension/test_arrow.py | 14 +++++++++++---
4898f3
 1 file changed, 11 insertions(+), 3 deletions(-)
4898f3
4898f3
diff --git a/pandas/tests/extension/test_arrow.py b/pandas/tests/extension/test_arrow.py
4898f3
index d9a3033b83..c551fff040 100644
4898f3
--- a/pandas/tests/extension/test_arrow.py
4898f3
+++ b/pandas/tests/extension/test_arrow.py
4898f3
@@ -26,6 +26,7 @@ from io import (
4898f3
 import operator
4898f3
 import pickle
4898f3
 import re
4898f3
+import sys
4898f3
 
4898f3
 import numpy as np
4898f3
 import pytest
4898f3
@@ -2106,14 +2107,21 @@ def test_str_removeprefix(val):
4898f3
 @pytest.mark.parametrize(
4898f3
     "encoding, exp",
4898f3
     [
4898f3
-        ["utf8", b"abc"],
4898f3
-        ["utf32", b"\xff\xfe\x00\x00a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00"],
4898f3
+        ("utf8", {"little": b"abc", "big": "abc"}),
4898f3
+        (
4898f3
+            "utf32",
4898f3
+            {
4898f3
+                "little": b"\xff\xfe\x00\x00a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00",
4898f3
+                "big": b"\x00\x00\xfe\xff\x00\x00\x00a\x00\x00\x00b\x00\x00\x00c",
4898f3
+            },
4898f3
+        ),
4898f3
     ],
4898f3
+    ids=["utf8", "utf32"],
4898f3
 )
4898f3
 def test_str_encode(errors, encoding, exp):
4898f3
     ser = pd.Series(["abc", None], dtype=ArrowDtype(pa.string()))
4898f3
     result = ser.str.encode(encoding, errors)
4898f3
-    expected = pd.Series([exp, None], dtype=ArrowDtype(pa.binary()))
4898f3
+    expected = pd.Series([exp[sys.byteorder], None], dtype=ArrowDtype(pa.binary()))
4898f3
     tm.assert_series_equal(result, expected)
4898f3
 
4898f3
 
4898f3
-- 
4898f3
2.43.0
4898f3