mverleg / pyjson_tricks

Extra features for Python's JSON: comments, order, numpy, pandas, datetimes, and many more! Simple but customizable.
Other
152 stars 23 forks source link

Test failures on s390x (big endian) architecture with 3.17.1 #88

Open cboltz opened 1 year ago

cboltz commented 1 year ago

The 3.17.1 release makes the test results on s390x much better, but a few issues remain:

[   20s] =================================== FAILURES ===================================
[   20s] ____________________ test_decode_compact_mixed_compactness _____________________
[   20s] 
[   20s]     def test_decode_compact_mixed_compactness():
[   20s]        json = '[{"__ndarray__": "b64:AAAAAAAA8D8AAAAAAAAAQAAAAAAAAAhAAAAAAAAAEEAAAAAAAAA' \
[   20s]            'UQAAAAAAAABhAAAAAAAAAHEAAAAAAAAAgQA==", "dtype": "float64", "shape": [2, 4], "Corder": ' \
[   20s]            'true}, {"__ndarray__": [3.141592653589793, 2.718281828459045], "dtype": "float64", "shape": [2]}]'
[   20s]        data = loads(json)
[   20s] >      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)]))
[   20s] 
[   20s] tests/test_np.py:316: 
[   20s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   20s] 
[   20s] args = (<built-in function eq>, array([[3.03865e-319, 3.16202e-322, 1.04347e-320, 2.05531e-320],
[   20s]        [2.56124e-320, 3.06716e-320, 3.57308e-320, 4.07901e-320]]), array([[1., 2., 3., 4.],
[   20s]        [5., 6., 7., 8.]]))
[   20s] kwds = {'err_msg': array([3.14159265, 2.71828183]), 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}
[   20s] 
[   20s]     @wraps(func)
[   20s]     def inner(*args, **kwds):
[   20s]         with self._recreate_cm():
[   20s] >           return func(*args, **kwds)
[   20s] E           numpy.core._exceptions._UFuncNoLoopError: ufunc 'add' did not contain a loop with signature matching types (dtype('float64'), dtype('>U90')) -> None
[   20s] 
[   20s] /usr/lib64/python3.9/contextlib.py:79: UFuncTypeError
[   20s] ____________________ test_decode_compact_inline_compression ____________________
[   20s] 
[   20s]     def test_decode_compact_inline_compression():
[   20s]        json = '[{"__ndarray__": "b64.gz:H4sIAAAAAAAC/2NgAIEP9gwQ4AChOKC0AJQWgdISUFoGSitAaSUorQKl1aC0BpTWgtI6UFoPShs4AABmfqWAgAAAAA==", "dtype": "float64", "shape": [4, 4], "Corder": true}]'
[   20s]        data = loads(json)
[   20s] >      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]]))
[   20s] 
[   20s] tests/test_np.py:348: 
[   20s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   20s] 
[   20s] args = (<built-in function eq>, array([[3.03865e-319, 3.16202e-322, 1.04347e-320, 2.05531e-320],
[   20s]        [2.56124e-320, 3.0671..., array([[ 1.,  2.,  3.,  4.],
[   20s]        [ 5.,  6.,  7.,  8.],
[   20s]        [ 9., 10., 11., 12.],
[   20s]        [13., 14., 15., 16.]]))
[   20s] kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}
[   20s] 
[   20s]     @wraps(func)
[   20s]     def inner(*args, **kwds):
[   20s]         with self._recreate_cm():
[   20s] >           return func(*args, **kwds)
[   20s] E           AssertionError: 
[   20s] E           Arrays are not equal
[   20s] E           
[   20s] E           Mismatched elements: 16 / 16 (100%)
[   20s] E           Max absolute difference: 16.
[   20s] E           Max relative difference: 1.
[   20s] E            x: array([[3.03865e-319, 3.16202e-322, 1.04347e-320, 2.05531e-320],
[   20s] E                  [2.56124e-320, 3.06716e-320, 3.57308e-320, 4.07901e-320],
[   20s] E                  [4.33197e-320, 4.58493e-320, 4.83789e-320, 5.09085e-320],
[   20s] E                  [5.34381e-320, 5.59678e-320, 5.84974e-320, 6.10270e-320]])
[   20s] E            y: array([[ 1.,  2.,  3.,  4.],
[   20s] E                  [ 5.,  6.,  7.,  8.],
[   20s] E                  [ 9., 10., 11., 12.],
[   20s] E                  [13., 14., 15., 16.]])
[   20s] 
[   20s] /usr/lib64/python3.9/contextlib.py:79: AssertionError
[   20s] __________________ test_decode_compact_no_inline_compression ___________________
[   20s] 
[   20s]     def test_decode_compact_no_inline_compression():
[   20s]        json = '[{"__ndarray__": "b64:AAAAAAAA8D8AAAAAAAAAQAAAAAAAAAhAAAAAAAAAEEA=", ' \
[   20s]            '"dtype": "float64", "shape": [2, 2], "Corder": true}]'
[   20s]        data = loads(json)
[   20s] >      assert_equal(data[0], array([[1.0, 2.0], [3.0, 4.0]]))
[   20s] 
[   20s] tests/test_np.py:355: 
[   20s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   20s] 
[   20s] args = (<built-in function eq>, array([[3.03865e-319, 3.16202e-322],
[   20s]        [1.04347e-320, 2.05531e-320]]), array([[1., 2.],
[   20s]        [3., 4.]]))
[   20s] kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}
[   20s] 
[   20s]     @wraps(func)
[   20s]     def inner(*args, **kwds):
[   20s]         with self._recreate_cm():
[   20s] >           return func(*args, **kwds)
[   20s] E           AssertionError: 
[   20s] E           Arrays are not equal
[   20s] E           
[   20s] E           Mismatched elements: 4 / 4 (100%)
[   20s] E           Max absolute difference: 4.
[   20s] E           Max relative difference: 1.
[   20s] E            x: array([[3.03865e-319, 3.16202e-322],
[   20s] E                  [1.04347e-320, 2.05531e-320]])
[   20s] E            y: array([[1., 2.],
[   20s] E                  [3., 4.]])
[   20s] 
[   20s] /usr/lib64/python3.9/contextlib.py:79: AssertionError
[   20s] =============================== warnings summary ===============================
[   20s] json_tricks/np.py:22
[   20s]   /home/abuild/rpmbuild/BUILD/pyjson_tricks-3.17.1/json_tricks/np.py:22: JsonTricksDeprecation: `json_tricks.np` is deprecated, you can import directly from `json_tricks`
[   20s]     warnings.warn('`json_tricks.np` is deprecated, you can import directly from `json_tricks`', JsonTricksDeprecation)
[   20s] 
[   20s] tests/test_bare.py::test_ignore_comments_deprecation
[   20s] tests/test_bare.py::test_ignore_comments_deprecation
[   20s] tests/test_bare.py::test_ignore_comments_deprecation
[   20s] tests/test_bare.py::test_ignore_comments_deprecation
[   20s] tests/test_np.py::test_compact_mode_unspecified
[   20s]   /usr/lib/python3.9/site-packages/_pytest/python.py:194: PytestRemovedIn8Warning: Passing None has been deprecated.
[   20s]   See https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.
[   20s]     result = testfunction(**testargs)
[   20s] 
[   20s] tests/test_np.py::test_file_numpy
[   20s]   /home/abuild/rpmbuild/BUILD/pyjson_tricks-3.17.1/json_tricks/encoders.py:385: JsonTricksDeprecation: storing ndarray in text format while compression in enabled; in the next major version of json_tricks, the default when using compression will change to compact mode; to already use that smaller format, pass `properties={"ndarray_compact": True}` to json_tricks.dump; to silence this warning, pass `properties={"ndarray_compact": False}`; see issue https://github.com/mverleg/pyjson_tricks/issues/73
[   20s]     warnings.warn('storing ndarray in text format while compression in enabled; in the next major version '
[   20s] 
[   20s] tests/test_np.py::test_scalars_types
[   20s]   /home/abuild/rpmbuild/BUILD/pyjson_tricks-3.17.1/json_tricks/encoders.py:412: UserWarning: json-tricks: numpy scalar serialization is experimental and may work differently in future versions
[   20s]     warnings.warn('json-tricks: numpy scalar serialization is experimental and may work differently in future versions')
[   20s] 
[   20s] -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
[   20s] =========================== short test summary info ============================
[   20s] FAILED tests/test_np.py::test_decode_compact_mixed_compactness - numpy.core._...
[   20s] FAILED tests/test_np.py::test_decode_compact_inline_compression - AssertionEr...
[   20s] FAILED tests/test_np.py::test_decode_compact_no_inline_compression - Assertio...
[   20s] ============= 3 failed, 93 passed, 1 skipped, 8 warnings in 0.69s ==============

The failures are specific to s390x.

The warnings also appear when building on x86_64.