Skip to content
Snippets Groups Projects
Commit b263e14d authored by Colin Watson's avatar Colin Watson
Browse files

Fix test failures on big-endian systems

Closes: #1104240
parent 727284a6
No related branches found
No related tags found
No related merge requests found
json-tricks (3.17.3-2) UNRELEASED; urgency=medium
[ Chris Hofstaedtler ]
* Fix test failures on big-endian systems (closes: #1104240).
-- Colin Watson <cjwatson@debian.org> Mon, 28 Apr 2025 00:11:13 +0100
json-tricks (3.17.3-1) unstable; urgency=medium
* Team upload.
......
fix-pytest-warnings.patch
tests-endian.patch
From: Chris Hofstaedtler <zeha@debian.org>
Date: Mon, 28 Apr 2025 00:08:51 +0100
Subject: Fix test failures on big-endian systems
Test data assumes tests are running on little-endian systems, or at least
that the native endianness is little. Obviously this breaks on big-endian
systems like s390x. Make the assumption explicit by adding "endian": "little"
to the to-decoded test-data.
Fixes FTBFS and CI test failures on s390x.
Bug: https://github.com/mverleg/pyjson_tricks/issues/88
Bug-Debian: https://bugs.debian.org/1104240
Last-Update: 2025-04-28
---
tests/test_np.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/test_np.py b/tests/test_np.py
index b7857ea..7b459e2 100644
--- a/tests/test_np.py
+++ b/tests/test_np.py
@@ -310,7 +310,7 @@ def test_encode_compact_no_inline_compression():
def test_decode_compact_mixed_compactness():
json = '[{"__ndarray__": "b64:AAAAAAAA8D8AAAAAAAAAQAAAAAAAAAhAAAAAAAAAEEAAAAAAAAA' \
- 'UQAAAAAAAABhAAAAAAAAAHEAAAAAAAAAgQA==", "dtype": "float64", "shape": [2, 4], "Corder": ' \
+ 'UQAAAAAAAABhAAAAAAAAAHEAAAAAAAAAgQA==", "dtype": "float64", "shape": [2, 4], "endian": "little", "Corder": ' \
'true}, {"__ndarray__": [3.141592653589793, 2.718281828459045], "dtype": "float64", "shape": [2]}]'
data = loads(json)
assert_equal(data[0], array([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]]), array([pi, exp(1)]))
@@ -343,14 +343,14 @@ def test_decode_without_endianness():
def test_decode_compact_inline_compression():
- json = '[{"__ndarray__": "b64.gz:H4sIAAAAAAAC/2NgAIEP9gwQ4AChOKC0AJQWgdISUFoGSitAaSUorQKl1aC0BpTWgtI6UFoPShs4AABmfqWAgAAAAA==", "dtype": "float64", "shape": [4, 4], "Corder": true}]'
+ json = '[{"__ndarray__": "b64.gz:H4sIAAAAAAAC/2NgAIEP9gwQ4AChOKC0AJQWgdISUFoGSitAaSUorQKl1aC0BpTWgtI6UFoPShs4AABmfqWAgAAAAA==", "dtype": "float64", "shape": [4, 4], "Corder": true, "endian": "little"}]'
data = loads(json)
assert_equal(data[0], array([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0], [9.0, 10.0, 11.0, 12.0], [13.0, 14.0, 15.0, 16.0]]))
def test_decode_compact_no_inline_compression():
json = '[{"__ndarray__": "b64:AAAAAAAA8D8AAAAAAAAAQAAAAAAAAAhAAAAAAAAAEEA=", ' \
- '"dtype": "float64", "shape": [2, 2], "Corder": true}]'
+ '"dtype": "float64", "shape": [2, 2], "Corder": true, "endian": "little"}]'
data = loads(json)
assert_equal(data[0], array([[1.0, 2.0], [3.0, 4.0]]))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment