File: tests-endian.patch

package info (click to toggle)
json-tricks 3.17.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 372 kB
  • sloc: python: 2,319; makefile: 159
file content (48 lines) | stat: -rw-r--r-- 2,404 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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]]))