Exemplo n.º 1
0
 def verify_packing(self, strings):
     packed, offset = util.pack_strings(strings)
     assert packed.dtype == np.int8
     assert offset.dtype == np.uint32
     assert packed.shape[0] == offset[-1]
     returned = util.unpack_strings(packed, offset)
     assert strings == returned
Exemplo n.º 2
0
 def verify_packing(self, strings):
     packed, offset = util.pack_strings(strings)
     self.assertEqual(packed.dtype, np.int8)
     self.assertEqual(offset.dtype, np.uint32)
     self.assertEqual(packed.shape[0], offset[-1])
     returned = util.unpack_strings(packed, offset)
     self.assertEqual(strings, returned)
Exemplo n.º 3
0
 def test_simple_string_case(self):
     strings = ["hello", "world"]
     packed, offset = util.pack_strings(strings)
     assert list(offset) == [0, 5, 10]
     assert packed.shape == (10,)
     returned = util.unpack_strings(packed, offset)
     assert returned == strings
Exemplo n.º 4
0
 def test_simple_string_case(self):
     strings = ["hello", "world"]
     packed, offset = util.pack_strings(strings)
     self.assertEqual(list(offset), [0, 5, 10])
     self.assertEqual(packed.shape, (10,))
     returned = util.unpack_strings(packed, offset)
     self.assertEqual(returned, strings)