Hello community,

here is the log from the commit of package python-msgpack-numpy for 
openSUSE:Factory checked in at 2019-07-24 20:34:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-msgpack-numpy (Old)
 and      /work/SRC/openSUSE:Factory/.python-msgpack-numpy.new.4126 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-msgpack-numpy"

Wed Jul 24 20:34:29 2019 rev:2 rq:718008 version:0.4.4.3

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-msgpack-numpy/python-msgpack-numpy.changes    
    2019-02-06 14:07:57.510643315 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-msgpack-numpy.new.4126/python-msgpack-numpy.changes
      2019-07-24 20:34:30.506580844 +0200
@@ -1,0 +2,8 @@
+Tue Jul 23 20:28:38 UTC 2019 - Todd R <toddrme2...@gmail.com>
+
+- Update to 0.4.4.3
+  * Configure contiguous integration with Travis.
+  * Move unit tests out of msgpack_numpy module.
+  * Add workaround for issue handling n-dim arrays on MacOS.
+
+-------------------------------------------------------------------

Old:
----
  msgpack-numpy-0.4.4.2.tar.gz

New:
----
  msgpack-numpy-0.4.4.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-msgpack-numpy.spec ++++++
--- /var/tmp/diff_new_pack.doDjMJ/_old  2019-07-24 20:34:30.894580802 +0200
+++ /var/tmp/diff_new_pack.doDjMJ/_new  2019-07-24 20:34:30.898580801 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-msgpack-numpy
-Version:        0.4.4.2
+Version:        0.4.4.3
 Release:        0
 Summary:        Numpy data serialization library using msgpack
 License:        BSD-3-Clause
@@ -55,6 +55,9 @@
 %python_install
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
+%check
+%python_exec -B tests.py
+
 %files %{python_files}
 %doc AUTHORS.rst CHANGES.rst README.rst
 %license LICENSE.rst

++++++ msgpack-numpy-0.4.4.2.tar.gz -> msgpack-numpy-0.4.4.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msgpack-numpy-0.4.4.2/CHANGES.rst 
new/msgpack-numpy-0.4.4.3/CHANGES.rst
--- old/msgpack-numpy-0.4.4.2/CHANGES.rst       2018-11-08 16:30:57.000000000 
+0100
+++ new/msgpack-numpy-0.4.4.3/CHANGES.rst       2019-05-16 14:11:42.000000000 
+0200
@@ -3,6 +3,12 @@
 Change Log
 ==========
 
+Release 0.4.4.3 (May 16, 2019)
+------------------------------
+* Configure contiguous integration with Travis.
+* Move unit tests out of msgpack_numpy module.
+* Add workaround for issue handling n-dim arrays on MacOS (#35).
+
 Release 0.4.4.2 (November 8, 2018)
 ----------------------------------
 * Fix regression handling noncontiguous arrays (#34).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msgpack-numpy-0.4.4.2/LICENSE.rst 
new/msgpack-numpy-0.4.4.3/LICENSE.rst
--- old/msgpack-numpy-0.4.4.2/LICENSE.rst       2018-02-26 03:43:23.000000000 
+0100
+++ new/msgpack-numpy-0.4.4.3/LICENSE.rst       2019-05-15 14:52:44.000000000 
+0200
@@ -3,7 +3,7 @@
 License
 =======
 
-Copyright (c) 2013-2018, Lev E. Givon.
+Copyright (c) 2013-2019, Lev E. Givon.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msgpack-numpy-0.4.4.2/PKG-INFO 
new/msgpack-numpy-0.4.4.3/PKG-INFO
--- old/msgpack-numpy-0.4.4.2/PKG-INFO  2018-11-08 16:33:33.000000000 +0100
+++ new/msgpack-numpy-0.4.4.3/PKG-INFO  2019-05-16 14:18:21.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: msgpack-numpy
-Version: 0.4.4.2
+Version: 0.4.4.3
 Summary: Numpy data serialization using msgpack
 Home-page: https://github.com/lebedov/msgpack-numpy
 Author: Lev E. Givon
@@ -17,6 +17,8 @@
         .. image:: https://img.shields.io/pypi/v/msgpack-numpy.svg
             :target: https://pypi.python.org/pypi/msgpack-numpy
             :alt: Latest Version
+        .. image:: 
https://travis-ci.org/lebedov/msgpack-numpy.svg?branch=master
+            :target: https://travis-ci.org/lebedov/msgpack-numpy
         
         Installation
         ------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msgpack-numpy-0.4.4.2/README.rst 
new/msgpack-numpy-0.4.4.3/README.rst
--- old/msgpack-numpy-0.4.4.2/README.rst        2018-09-26 03:37:53.000000000 
+0200
+++ new/msgpack-numpy-0.4.4.3/README.rst        2019-05-16 14:15:23.000000000 
+0200
@@ -14,6 +14,8 @@
 .. image:: https://img.shields.io/pypi/v/msgpack-numpy.svg
     :target: https://pypi.python.org/pypi/msgpack-numpy
     :alt: Latest Version
+.. image:: https://travis-ci.org/lebedov/msgpack-numpy.svg?branch=master
+    :target: https://travis-ci.org/lebedov/msgpack-numpy
 
 Installation
 ------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/msgpack-numpy-0.4.4.2/msgpack_numpy.egg-info/PKG-INFO 
new/msgpack-numpy-0.4.4.3/msgpack_numpy.egg-info/PKG-INFO
--- old/msgpack-numpy-0.4.4.2/msgpack_numpy.egg-info/PKG-INFO   2018-11-08 
16:33:33.000000000 +0100
+++ new/msgpack-numpy-0.4.4.3/msgpack_numpy.egg-info/PKG-INFO   2019-05-16 
14:18:21.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: msgpack-numpy
-Version: 0.4.4.2
+Version: 0.4.4.3
 Summary: Numpy data serialization using msgpack
 Home-page: https://github.com/lebedov/msgpack-numpy
 Author: Lev E. Givon
@@ -17,6 +17,8 @@
         .. image:: https://img.shields.io/pypi/v/msgpack-numpy.svg
             :target: https://pypi.python.org/pypi/msgpack-numpy
             :alt: Latest Version
+        .. image:: 
https://travis-ci.org/lebedov/msgpack-numpy.svg?branch=master
+            :target: https://travis-ci.org/lebedov/msgpack-numpy
         
         Installation
         ------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/msgpack-numpy-0.4.4.2/msgpack_numpy.egg-info/SOURCES.txt 
new/msgpack-numpy-0.4.4.3/msgpack_numpy.egg-info/SOURCES.txt
--- old/msgpack-numpy-0.4.4.2/msgpack_numpy.egg-info/SOURCES.txt        
2018-11-08 16:33:33.000000000 +0100
+++ new/msgpack-numpy-0.4.4.3/msgpack_numpy.egg-info/SOURCES.txt        
2019-05-16 14:18:21.000000000 +0200
@@ -5,6 +5,7 @@
 msgpack_numpy.py
 setup.cfg
 setup.py
+tests.py
 msgpack_numpy.egg-info/PKG-INFO
 msgpack_numpy.egg-info/SOURCES.txt
 msgpack_numpy.egg-info/dependency_links.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msgpack-numpy-0.4.4.2/msgpack_numpy.py 
new/msgpack-numpy-0.4.4.3/msgpack_numpy.py
--- old/msgpack-numpy-0.4.4.2/msgpack_numpy.py  2018-11-08 16:29:03.000000000 
+0100
+++ new/msgpack-numpy-0.4.4.3/msgpack_numpy.py  2019-05-15 20:34:15.000000000 
+0200
@@ -4,7 +4,7 @@
 Support for serialization of numpy data types with msgpack.
 """
 
-# Copyright (c) 2013-2018, Lev E. Givon
+# Copyright (c) 2013-2019, Lev E. Givon
 # All rights reserved.
 # Distributed under the terms of the BSD license:
 # http://www.opensource.org/licenses/bsd-license
@@ -12,41 +12,18 @@
 import sys
 import functools
 
-import numpy as np
 import msgpack
-
 from msgpack import Packer as _Packer, Unpacker as _Unpacker, \
     unpack as _unpack, unpackb as _unpackb
+import numpy as np
 
 if sys.version_info >= (3, 0):
-    def encode(obj, chain=None):
-        """
-        Data encoder for serializing numpy data types.
-        """
-
-        if isinstance(obj, np.ndarray):
-            # If the dtype is structured, store the interface description;
-            # otherwise, store the corresponding array protocol type string:
-            if obj.dtype.kind == 'V':
-                kind = b'V'
-                descr = obj.dtype.descr
-            else:
-                kind = b''
-                descr = obj.dtype.str
-            return {b'nd': True,
-                    b'type': descr,
-                    b'kind': kind,
-                    b'shape': obj.shape,
-                    b'data': obj.data if obj.flags['C_CONTIGUOUS'] else 
obj.tobytes()}
-        elif isinstance(obj, (np.bool_, np.number)):
-            return {b'nd': False,
-                    b'type': obj.dtype.str,
-                    b'data': obj.data}
-        elif isinstance(obj, complex):
-            return {b'complex': True,
-                    b'data': obj.__repr__()}
-        else:
-            return obj if chain is None else chain(obj)
+    if sys.platform == 'darwin':
+        ndarray_to_bytes = lambda obj: obj.tobytes()
+    else:
+        ndarray_to_bytes = lambda obj: obj.data if obj.flags['C_CONTIGUOUS'] 
else obj.tobytes()
+
+    num_to_bytes = lambda obj: obj.data
 
     def tostr(x):
         if isinstance(x, bytes):
@@ -54,38 +31,45 @@
         else:
             return str(x)
 else:
-    def encode(obj, chain=None):
-        """
-        Data encoder for serializing numpy data types.
-        """
-
-        if isinstance(obj, np.ndarray):
-            # If the dtype is structured, store the interface description;
-            # otherwise, store the corresponding array protocol type string:
-            if obj.dtype.kind == 'V':
-                kind = b'V'
-                descr = obj.dtype.descr
-            else:
-                kind = b''
-                descr = obj.dtype.str
-            return {b'nd': True,
-                    b'type': descr,
-                    b'kind': kind,
-                    b'shape': obj.shape,
-                    b'data': memoryview(obj.data) if obj.flags['C_CONTIGUOUS'] 
else obj.tobytes()}
-        elif isinstance(obj, (np.bool_, np.number)):
-            return {b'nd': False,
-                    b'type': obj.dtype.str,
-                    b'data': memoryview(obj.data)}
-        elif isinstance(obj, complex):
-            return {b'complex': True,
-                    b'data': obj.__repr__()}
-        else:
-            return obj if chain is None else chain(obj)
+    if sys.platform == 'darwin':
+        ndarray_to_bytes = lambda obj: obj.tobytes()
+    else:
+        ndarray_to_bytes = lambda obj: memoryview(obj.data) if 
obj.flags['C_CONTIGUOUS'] else obj.tobytes()
+
+    num_to_bytes = lambda obj: memoryview(obj.data)
 
     def tostr(x):
         return x
 
+def encode(obj, chain=None):
+    """
+    Data encoder for serializing numpy data types.
+    """
+
+    if isinstance(obj, np.ndarray):
+        # If the dtype is structured, store the interface description;
+        # otherwise, store the corresponding array protocol type string:
+        if obj.dtype.kind == 'V':
+            kind = b'V'
+            descr = obj.dtype.descr
+        else:
+            kind = b''
+            descr = obj.dtype.str
+        return {b'nd': True,
+                b'type': descr,
+                b'kind': kind,
+                b'shape': obj.shape,
+                b'data': ndarray_to_bytes(obj)}
+    elif isinstance(obj, (np.bool_, np.number)):
+        return {b'nd': False,
+                b'type': obj.dtype.str,
+                b'data': num_to_bytes(obj)}
+    elif isinstance(obj, complex):
+        return {b'complex': True,
+                b'data': obj.__repr__()}
+    else:
+        return obj if chain is None else chain(obj)
+
 def decode(obj, chain=None):
     """
     Decoder for deserializing numpy data types.
@@ -233,230 +217,3 @@
     setattr(msgpack, 'packb', packb)
     setattr(msgpack, 'unpack', unpack)
     setattr(msgpack, 'unpackb', unpackb)
-
-if __name__ == '__main__':
-    try:
-        range = xrange # Python 2
-    except NameError:
-        pass # Python 3
-
-    from unittest import main, TestCase
-    from numpy.testing import assert_equal, assert_array_equal
-
-    class ThirdParty(object):
-
-        def __init__(self, foo=b'bar'):
-            self.foo = foo
-
-        def __eq__(self, other):
-            return isinstance(other, ThirdParty) and self.foo == other.foo
-
-    class test_numpy_msgpack(TestCase):
-        def setUp(self):
-             patch()
-
-        def encode_decode(self, x, use_bin_type=False, raw=True):
-            x_enc = msgpack.packb(x, use_bin_type=use_bin_type)
-            return msgpack.unpackb(x_enc, raw=raw)
-
-        def encode_thirdparty(self, obj):
-            return dict(__thirdparty__=True, foo=obj.foo)
-
-        def decode_thirdparty(self, obj):
-            if b'__thirdparty__' in obj:
-                return ThirdParty(foo=obj[b'foo'])
-            return obj
-
-        def encode_decode_thirdparty(self, x, use_bin_type=False, raw=True):
-            x_enc = msgpack.packb(x, default=self.encode_thirdparty,
-                                  use_bin_type=use_bin_type)
-            return msgpack.unpackb(x_enc, raw=raw, 
object_hook=self.decode_thirdparty)
-
-        def test_bin(self):
-            # Since bytes == str in Python 2.7, the following
-            # should pass on both 2.7 and 3.*
-            assert_equal(type(self.encode_decode(b'foo')), bytes)
-
-        def test_str(self):
-            assert_equal(type(self.encode_decode('foo')), bytes)
-            if sys.version_info.major == 2:
-                assert_equal(type(self.encode_decode(u'foo')), str)
-
-                # Test non-default string encoding/decoding:
-                assert_equal(type(self.encode_decode(u'foo', True, False)), 
unicode)
-
-        def test_numpy_scalar_bool(self):
-            x = np.bool_(True)
-            x_rec = self.encode_decode(x)
-            assert_equal(x, x_rec)
-            assert_equal(type(x), type(x_rec))
-            x = np.bool_(False)
-            x_rec = self.encode_decode(x)
-            assert_equal(x, x_rec)
-            assert_equal(type(x), type(x_rec))
-
-        def test_numpy_scalar_float(self):
-            x = np.float32(np.random.rand())
-            x_rec = self.encode_decode(x)
-            assert_equal(x, x_rec)
-            assert_equal(type(x), type(x_rec))
-
-        def test_numpy_scalar_complex(self):
-            x = np.complex64(np.random.rand()+1j*np.random.rand())
-            x_rec = self.encode_decode(x)
-            assert_equal(x, x_rec)
-            assert_equal(type(x), type(x_rec))
-
-        def test_scalar_float(self):
-            x = np.random.rand()
-            x_rec = self.encode_decode(x)
-            assert_equal(x, x_rec)
-            assert_equal(type(x), type(x_rec))
-
-        def test_scalar_complex(self):
-            x = np.random.rand()+1j*np.random.rand()
-            x_rec = self.encode_decode(x)
-            assert_equal(x, x_rec)
-            assert_equal(type(x), type(x_rec))
-
-        def test_list_numpy_float(self):
-            x = [np.float32(np.random.rand()) for i in range(5)]
-            x_rec = self.encode_decode(x)
-            assert_array_equal(x, x_rec)
-            assert_array_equal([type(e) for e in x],
-                               [type(e) for e in x_rec])
-
-        def test_list_numpy_float_complex(self):
-            x = [np.float32(np.random.rand()) for i in range(5)] + \
-              [np.complex128(np.random.rand()+1j*np.random.rand()) for i in 
range(5)]
-            x_rec = self.encode_decode(x)
-            assert_array_equal(x, x_rec)
-            assert_array_equal([type(e) for e in x],
-                               [type(e) for e in x_rec])
-
-        def test_list_float(self):
-            x = [np.random.rand() for i in range(5)]
-            x_rec = self.encode_decode(x)
-            assert_array_equal(x, x_rec)
-            assert_array_equal([type(e) for e in x],
-                               [type(e) for e in x_rec])
-
-        def test_list_float_complex(self):
-            x = [(np.random.rand()+1j*np.random.rand()) for i in range(5)]
-            x_rec = self.encode_decode(x)
-            assert_array_equal(x, x_rec)
-            assert_array_equal([type(e) for e in x],
-                               [type(e) for e in x_rec])
-
-        def test_list_str(self):
-            x = [b'x'*i for i in range(5)]
-            x_rec = self.encode_decode(x)
-            assert_array_equal(x, x_rec)
-            assert_array_equal([type(e) for e in x_rec], [bytes]*5)
-
-        def test_dict_float(self):
-            x = {b'foo': 1.0, b'bar': 2.0}
-            x_rec = self.encode_decode(x)
-            assert_array_equal(sorted(x.values()), sorted(x_rec.values()))
-            assert_array_equal([type(e) for e in sorted(x.values())],
-                               [type(e) for e in sorted(x_rec.values())])
-            assert_array_equal(sorted(x.keys()), sorted(x_rec.keys()))
-            assert_array_equal([type(e) for e in sorted(x.keys())],
-                               [type(e) for e in sorted(x_rec.keys())])
-
-        def test_dict_complex(self):
-            x = {b'foo': 1.0+1.0j, b'bar': 2.0+2.0j}
-            x_rec = self.encode_decode(x)
-            assert_array_equal(sorted(x.values(), key=np.linalg.norm),
-                               sorted(x_rec.values(), key=np.linalg.norm))
-            assert_array_equal([type(e) for e in sorted(x.values(), 
key=np.linalg.norm)],
-                               [type(e) for e in sorted(x_rec.values(), 
key=np.linalg.norm)])
-            assert_array_equal(sorted(x.keys()), sorted(x_rec.keys()))
-            assert_array_equal([type(e) for e in sorted(x.keys())],
-                               [type(e) for e in sorted(x_rec.keys())])
-
-        def test_dict_str(self):
-            x = {b'foo': b'xxx', b'bar': b'yyyy'}
-            x_rec = self.encode_decode(x)
-            assert_array_equal(sorted(x.values()), sorted(x_rec.values()))
-            assert_array_equal([type(e) for e in sorted(x.values())],
-                               [type(e) for e in sorted(x_rec.values())])
-            assert_array_equal(sorted(x.keys()), sorted(x_rec.keys()))
-            assert_array_equal([type(e) for e in sorted(x.keys())],
-                               [type(e) for e in sorted(x_rec.keys())])
-
-        def test_dict_numpy_float(self):
-            x = {b'foo': np.float32(1.0), b'bar': np.float32(2.0)}
-            x_rec = self.encode_decode(x)
-            assert_array_equal(sorted(x.values()), sorted(x_rec.values()))
-            assert_array_equal([type(e) for e in sorted(x.values())],
-                               [type(e) for e in sorted(x_rec.values())])
-            assert_array_equal(sorted(x.keys()), sorted(x_rec.keys()))
-            assert_array_equal([type(e) for e in sorted(x.keys())],
-                               [type(e) for e in sorted(x_rec.keys())])
-
-        def test_dict_numpy_complex(self):
-            x = {b'foo': np.complex128(1.0+1.0j), b'bar': 
np.complex128(2.0+2.0j)}
-            x_rec = self.encode_decode(x)
-            assert_array_equal(sorted(x.values(), key=np.linalg.norm),
-                               sorted(x_rec.values(), key=np.linalg.norm))
-            assert_array_equal([type(e) for e in sorted(x.values(), 
key=np.linalg.norm)],
-                               [type(e) for e in sorted(x_rec.values(), 
key=np.linalg.norm)])
-            assert_array_equal(sorted(x.keys()), sorted(x_rec.keys()))
-            assert_array_equal([type(e) for e in sorted(x.keys())],
-                               [type(e) for e in sorted(x_rec.keys())])
-
-        def test_numpy_array_float(self):
-            x = np.random.rand(5).astype(np.float32)
-            x_rec = self.encode_decode(x)
-            assert_array_equal(x, x_rec)
-            assert_equal(x.dtype, x_rec.dtype)
-
-        def test_numpy_array_complex(self):
-            x = (np.random.rand(5)+1j*np.random.rand(5)).astype(np.complex128)
-            x_rec = self.encode_decode(x)
-            assert_array_equal(x, x_rec)
-            assert_equal(x.dtype, x_rec.dtype)
-
-        def test_numpy_array_float_2d(self):
-            x = np.random.rand(5,5).astype(np.float32)
-            x_rec = self.encode_decode(x)
-            assert_array_equal(x, x_rec)
-            assert_equal(x.dtype, x_rec.dtype)
-
-        def test_numpy_array_str(self):
-            x = np.array([b'aaa', b'bbbb', b'ccccc'])
-            x_rec = self.encode_decode(x)
-            assert_array_equal(x, x_rec)
-            assert_equal(x.dtype, x_rec.dtype)
-
-        def test_numpy_array_mixed(self):
-            x = np.array([(1, 2, b'a', [1.0, 2.0])],
-                         np.dtype([('arg0', np.uint32),
-                                   ('arg1', np.uint32),
-                                   ('arg2', 'S1'),
-                                   ('arg3', np.float32, (2,))]))
-            x_rec = self.encode_decode(x)
-            assert_array_equal(x, x_rec)
-            assert_equal(x.dtype, x_rec.dtype)
-
-        def test_numpy_array_noncontiguous(self):
-            x = np.ones((10, 10), np.uint32)[0:5, 0:5]
-            x_rec = self.encode_decode(x)
-            assert_array_equal(x, x_rec)
-            assert_equal(x.dtype, x_rec.dtype)
-
-        def test_list_mixed(self):
-            x = [1.0, np.float32(3.5), np.complex128(4.25), b'foo']
-            x_rec = self.encode_decode(x)
-            assert_array_equal(x, x_rec)
-            assert_array_equal([type(e) for e in x],
-                               [type(e) for e in x_rec])
-
-        def test_chain(self):
-            x = ThirdParty(foo=b'test marshal/unmarshal')
-            x_rec = self.encode_decode_thirdparty(x)
-            self.assertEqual(x, x_rec)
-
-    main()
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msgpack-numpy-0.4.4.2/setup.py 
new/msgpack-numpy-0.4.4.3/setup.py
--- old/msgpack-numpy-0.4.4.2/setup.py  2018-11-08 16:31:05.000000000 +0100
+++ new/msgpack-numpy-0.4.4.3/setup.py  2019-05-16 14:11:56.000000000 +0200
@@ -6,7 +6,7 @@
 from setuptools import setup
 
 NAME =               'msgpack-numpy'
-VERSION =            '0.4.4.2'
+VERSION =            '0.4.4.3'
 AUTHOR =             'Lev E. Givon'
 AUTHOR_EMAIL =       'l...@columbia.edu'
 URL =                'https://github.com/lebedov/msgpack-numpy'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msgpack-numpy-0.4.4.2/tests.py 
new/msgpack-numpy-0.4.4.3/tests.py
--- old/msgpack-numpy-0.4.4.2/tests.py  1970-01-01 01:00:00.000000000 +0100
+++ new/msgpack-numpy-0.4.4.3/tests.py  2019-05-16 14:10:59.000000000 +0200
@@ -0,0 +1,248 @@
+#!/usr/bin/env python
+
+import sys
+from unittest import main, TestCase
+
+import msgpack
+import numpy as np
+from numpy.testing import assert_equal, assert_array_equal
+
+from msgpack_numpy import patch
+
+try:
+    range = xrange # Python 2
+except NameError:
+    pass # Python 3
+
+class ThirdParty(object):
+
+    def __init__(self, foo=b'bar'):
+        self.foo = foo
+
+    def __eq__(self, other):
+        return isinstance(other, ThirdParty) and self.foo == other.foo
+
+class test_numpy_msgpack(TestCase):
+    def setUp(self):
+         patch()
+
+    def encode_decode(self, x, use_bin_type=False, raw=True,
+                      use_list=True, max_bin_len=-1):
+        x_enc = msgpack.packb(x, use_bin_type=use_bin_type)
+        return msgpack.unpackb(x_enc, raw=raw, use_list=use_list,
+                               max_bin_len=max_bin_len)
+
+    def encode_thirdparty(self, obj):
+        return dict(__thirdparty__=True, foo=obj.foo)
+
+    def decode_thirdparty(self, obj):
+        if b'__thirdparty__' in obj:
+            return ThirdParty(foo=obj[b'foo'])
+        return obj
+
+    def encode_decode_thirdparty(self, x, use_bin_type=False, raw=True,
+            use_list=True, max_bin_len=-1):
+        x_enc = msgpack.packb(x, default=self.encode_thirdparty,
+                              use_bin_type=use_bin_type)
+        return msgpack.unpackb(x_enc, raw=raw,
+                               object_hook=self.decode_thirdparty,
+                               use_list=use_list, max_bin_len=max_bin_len)
+
+    def test_bin(self):
+        # Since bytes == str in Python 2.7, the following
+        # should pass on both 2.7 and 3.*
+        assert_equal(type(self.encode_decode(b'foo')), bytes)
+
+    def test_str(self):
+        assert_equal(type(self.encode_decode('foo')), bytes)
+        if sys.version_info.major == 2:
+            assert_equal(type(self.encode_decode(u'foo')), str)
+
+            # Test non-default string encoding/decoding:
+            assert_equal(type(self.encode_decode(u'foo', True, False)), 
unicode)
+
+    def test_numpy_scalar_bool(self):
+        x = np.bool_(True)
+        x_rec = self.encode_decode(x)
+        assert_equal(x, x_rec)
+        assert_equal(type(x), type(x_rec))
+        x = np.bool_(False)
+        x_rec = self.encode_decode(x)
+        assert_equal(x, x_rec)
+        assert_equal(type(x), type(x_rec))
+
+    def test_numpy_scalar_float(self):
+        x = np.float32(np.random.rand())
+        x_rec = self.encode_decode(x)
+        assert_equal(x, x_rec)
+        assert_equal(type(x), type(x_rec))
+
+    def test_numpy_scalar_complex(self):
+        x = np.complex64(np.random.rand()+1j*np.random.rand())
+        x_rec = self.encode_decode(x)
+        assert_equal(x, x_rec)
+        assert_equal(type(x), type(x_rec))
+
+    def test_scalar_float(self):
+        x = np.random.rand()
+        x_rec = self.encode_decode(x)
+        assert_equal(x, x_rec)
+        assert_equal(type(x), type(x_rec))
+
+    def test_scalar_complex(self):
+        x = np.random.rand()+1j*np.random.rand()
+        x_rec = self.encode_decode(x)
+        assert_equal(x, x_rec)
+        assert_equal(type(x), type(x_rec))
+
+    def test_list_numpy_float(self):
+        x = [np.float32(np.random.rand()) for i in range(5)]
+        x_rec = self.encode_decode(x)
+        assert_array_equal(x, x_rec)
+        assert_array_equal([type(e) for e in x],
+                           [type(e) for e in x_rec])
+
+    def test_list_numpy_float_complex(self):
+        x = [np.float32(np.random.rand()) for i in range(5)] + \
+          [np.complex128(np.random.rand()+1j*np.random.rand()) for i in 
range(5)]
+        x_rec = self.encode_decode(x)
+        assert_array_equal(x, x_rec)
+        assert_array_equal([type(e) for e in x],
+                           [type(e) for e in x_rec])
+
+    def test_list_float(self):
+        x = [np.random.rand() for i in range(5)]
+        x_rec = self.encode_decode(x)
+        assert_array_equal(x, x_rec)
+        assert_array_equal([type(e) for e in x],
+                           [type(e) for e in x_rec])
+
+    def test_list_float_complex(self):
+        x = [(np.random.rand()+1j*np.random.rand()) for i in range(5)]
+        x_rec = self.encode_decode(x)
+        assert_array_equal(x, x_rec)
+        assert_array_equal([type(e) for e in x],
+                           [type(e) for e in x_rec])
+
+    def test_list_str(self):
+        x = [b'x'*i for i in range(5)]
+        x_rec = self.encode_decode(x)
+        assert_array_equal(x, x_rec)
+        assert_array_equal([type(e) for e in x_rec], [bytes]*5)
+
+    def test_dict_float(self):
+        x = {b'foo': 1.0, b'bar': 2.0}
+        x_rec = self.encode_decode(x)
+        assert_array_equal(sorted(x.values()), sorted(x_rec.values()))
+        assert_array_equal([type(e) for e in sorted(x.values())],
+                           [type(e) for e in sorted(x_rec.values())])
+        assert_array_equal(sorted(x.keys()), sorted(x_rec.keys()))
+        assert_array_equal([type(e) for e in sorted(x.keys())],
+                           [type(e) for e in sorted(x_rec.keys())])
+
+    def test_dict_complex(self):
+        x = {b'foo': 1.0+1.0j, b'bar': 2.0+2.0j}
+        x_rec = self.encode_decode(x)
+        assert_array_equal(sorted(x.values(), key=np.linalg.norm),
+                           sorted(x_rec.values(), key=np.linalg.norm))
+        assert_array_equal([type(e) for e in sorted(x.values(), 
key=np.linalg.norm)],
+                           [type(e) for e in sorted(x_rec.values(), 
key=np.linalg.norm)])
+        assert_array_equal(sorted(x.keys()), sorted(x_rec.keys()))
+        assert_array_equal([type(e) for e in sorted(x.keys())],
+                           [type(e) for e in sorted(x_rec.keys())])
+
+    def test_dict_str(self):
+        x = {b'foo': b'xxx', b'bar': b'yyyy'}
+        x_rec = self.encode_decode(x)
+        assert_array_equal(sorted(x.values()), sorted(x_rec.values()))
+        assert_array_equal([type(e) for e in sorted(x.values())],
+                           [type(e) for e in sorted(x_rec.values())])
+        assert_array_equal(sorted(x.keys()), sorted(x_rec.keys()))
+        assert_array_equal([type(e) for e in sorted(x.keys())],
+                           [type(e) for e in sorted(x_rec.keys())])
+
+    def test_dict_numpy_float(self):
+        x = {b'foo': np.float32(1.0), b'bar': np.float32(2.0)}
+        x_rec = self.encode_decode(x)
+        assert_array_equal(sorted(x.values()), sorted(x_rec.values()))
+        assert_array_equal([type(e) for e in sorted(x.values())],
+                           [type(e) for e in sorted(x_rec.values())])
+        assert_array_equal(sorted(x.keys()), sorted(x_rec.keys()))
+        assert_array_equal([type(e) for e in sorted(x.keys())],
+                           [type(e) for e in sorted(x_rec.keys())])
+
+    def test_dict_numpy_complex(self):
+        x = {b'foo': np.complex128(1.0+1.0j), b'bar': np.complex128(2.0+2.0j)}
+        x_rec = self.encode_decode(x)
+        assert_array_equal(sorted(x.values(), key=np.linalg.norm),
+                           sorted(x_rec.values(), key=np.linalg.norm))
+        assert_array_equal([type(e) for e in sorted(x.values(), 
key=np.linalg.norm)],
+                           [type(e) for e in sorted(x_rec.values(), 
key=np.linalg.norm)])
+        assert_array_equal(sorted(x.keys()), sorted(x_rec.keys()))
+        assert_array_equal([type(e) for e in sorted(x.keys())],
+                           [type(e) for e in sorted(x_rec.keys())])
+
+    def test_numpy_array_float(self):
+        x = np.random.rand(5).astype(np.float32)
+        x_rec = self.encode_decode(x)
+        assert_array_equal(x, x_rec)
+        assert_equal(x.dtype, x_rec.dtype)
+
+    def test_numpy_array_complex(self):
+        x = (np.random.rand(5)+1j*np.random.rand(5)).astype(np.complex128)
+        x_rec = self.encode_decode(x)
+        assert_array_equal(x, x_rec)
+        assert_equal(x.dtype, x_rec.dtype)
+
+    def test_numpy_array_float_2d(self):
+        x = np.random.rand(5,5).astype(np.float32)
+        x_rec = self.encode_decode(x)
+        assert_array_equal(x, x_rec)
+        assert_equal(x.dtype, x_rec.dtype)
+
+    def test_numpy_array_float_2d_macos(self):
+        """
+        Unit test for weird data loss error on MacOS (#35).
+        """
+        x = np.random.rand(5,5).astype(np.float32)
+        x_rec = self.encode_decode(x, use_bin_type=True, raw=False,
+                                   use_list=False, max_bin_len=50000000)
+        assert_array_equal(x, x_rec)
+        assert_equal(x.dtype, x_rec.dtype)
+
+    def test_numpy_array_str(self):
+        x = np.array([b'aaa', b'bbbb', b'ccccc'])
+        x_rec = self.encode_decode(x)
+        assert_array_equal(x, x_rec)
+        assert_equal(x.dtype, x_rec.dtype)
+
+    def test_numpy_array_mixed(self):
+        x = np.array([(1, 2, b'a', [1.0, 2.0])],
+                     np.dtype([('arg0', np.uint32),
+                               ('arg1', np.uint32),
+                               ('arg2', 'S1'),
+                               ('arg3', np.float32, (2,))]))
+        x_rec = self.encode_decode(x)
+        assert_array_equal(x, x_rec)
+        assert_equal(x.dtype, x_rec.dtype)
+
+    def test_numpy_array_noncontiguous(self):
+        x = np.ones((10, 10), np.uint32)[0:5, 0:5]
+        x_rec = self.encode_decode(x)
+        assert_array_equal(x, x_rec)
+        assert_equal(x.dtype, x_rec.dtype)
+
+    def test_list_mixed(self):
+        x = [1.0, np.float32(3.5), np.complex128(4.25), b'foo']
+        x_rec = self.encode_decode(x)
+        assert_array_equal(x, x_rec)
+        assert_array_equal([type(e) for e in x],
+                           [type(e) for e in x_rec])
+
+    def test_chain(self):
+        x = ThirdParty(foo=b'test marshal/unmarshal')
+        x_rec = self.encode_decode_thirdparty(x)
+        self.assertEqual(x, x_rec)
+
+if __name__ == '__main__':
+    main()


Reply via email to