from pandas.arrays import BooleanArray
from pandas.core.arrays.boolean import coerce_to_array
from pandas.tests.extension.base import BaseOpsUtil
+from pandas.compat import is_platform_little_endian
def make_data():
arr = con([True, False, None], dtype="boolean")
result = arr.to_numpy(dtype="str")
- expected = np.array([True, False, pd.NA], dtype="<U5")
+ expected = np.array([True, False, pd.NA], dtype="<U5" if is_platform_little_endian() else ">U5")
tm.assert_numpy_array_equal(result, expected)
# no missing values -> can convert to bool, otherwise raises
from pandas import CategoricalDtype, DataFrame, MultiIndex, Series, date_range
import pandas._testing as tm
+from pandas.compat import is_platform_little_endian
class TestDataFrameToRecords:
),
],
)
+ @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"]})
),
],
)
+ @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:
"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"],
)
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