test_serialize.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:dfkernel 作者: dataflownb 项目源码 文件源码
def test_numpy_in_dict():
    import numpy
    from numpy.testing.utils import assert_array_equal
    for shape in SHAPES:
        for dtype in DTYPES:
            A = new_array(shape, dtype=dtype)
            bufs = serialize_object(dict(a=A,b=1,c=range(20)))
            canned = pickle.loads(bufs[0])
            nt.assert_is_instance(canned['a'], CannedArray)
            d, r = deserialize_object(bufs)
            B = d['a']
            nt.assert_equal(r, [])
            nt.assert_equal(A.shape, B.shape)
            nt.assert_equal(A.dtype, B.dtype)
            assert_array_equal(A,B)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号