def test_encode_utf8(): a = np.array([u'foo', None, u'bar'], dtype=object) codec = VLenUTF8() enc = codec.encode(a) dec = codec.decode(enc) expect = np.array([u'foo', u'', u'bar'], dtype=object) assert_array_items_equal(expect, dec)
def test_encode_none(): a = np.array([b'foo', None, b'bar'], dtype=object) codec = VLenBytes() enc = codec.encode(a) dec = codec.decode(enc) expect = np.array([b'foo', b'', b'bar'], dtype=object) assert_array_items_equal(expect, dec)
def test_encode_none(): a = np.array([[1, 3], None, [4, 7]], dtype=object) codec = VLenArray(int) enc = codec.encode(a) dec = codec.decode(enc) expect = np.array( [np.array([1, 3]), np.array([]), np.array([4, 7])], dtype=object) assert_array_items_equal(expect, dec)