Skip to content

Fix some little-endian assumptions in the tests #49913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pandas/tests/arrays/floating/test_arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ def test_error_invalid_values(data, all_arithmetic_operators):
"not all arguments converted during string formatting",
"can't multiply sequence by non-int of type 'float'",
"ufunc 'subtract' cannot use operands with types dtype",
r"ufunc 'add' cannot use operands with types dtype\('<M8\[ns\]'\)",
(
"ufunc 'add' cannot use operands with types "
rf"dtype\('{tm.ENDIAN}M8\[ns\]'\)"
),
r"ufunc 'add' cannot use operands with types dtype\('float\d{2}'\)",
"cannot subtract DatetimeArray from ndarray",
]
Expand Down
14 changes: 12 additions & 2 deletions pandas/tests/frame/methods/test_to_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ def test_to_records_index_name(self):
+ [np.asarray(df.iloc[:, i]) for i in range(3)],
dtype={
"names": ["A", "level_1", "0", "1", "2"],
"formats": ["O", "O", "<f8", "<f8", "<f8"],
"formats": [
"O",
"O",
f"{tm.ENDIAN}f8",
f"{tm.ENDIAN}f8",
f"{tm.ENDIAN}f8",
],
},
)
tm.assert_numpy_array_equal(result, expected)
Expand All @@ -123,7 +129,11 @@ def test_to_records_index_dtype(self):
("2022-01-01", "2022-01-01", "2022-01-01"),
("2022-01-02", "2022-01-02", "2022-01-02"),
],
dtype=[("1", "<M8[ns]"), ("2", "<M8[ns]"), ("3", "<M8[ns]")],
dtype=[
("1", f"{tm.ENDIAN}M8[ns]"),
("2", f"{tm.ENDIAN}M8[ns]"),
("3", f"{tm.ENDIAN}M8[ns]"),
],
)

result = df.to_records(index=False)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/scalar/timedelta/test_arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def test_td_mul_td64_ndarray_invalid(self):

msg = (
"ufunc '?multiply'? cannot use operands with types "
r"dtype\('<m8\[ns\]'\) and dtype\('<m8\[ns\]'\)"
rf"dtype\('{tm.ENDIAN}m8\[ns\]'\) and dtype\('{tm.ENDIAN}m8\[ns\]'\)"
)
with pytest.raises(TypeError, match=msg):
td * other
Expand Down