def test_copy_from(self):
a = DynamicArray(0, numpy.dtype([
('a', numpy.int8),
('b', numpy.float32),
('c', numpy.float64),
]))
a.extend([
(4, 3.932, 902.345),
(7, 1.016, 548.229),
(2, 0.542, 771.031),
(8, 5.429, 858.063),
])
b = DynamicArray(0, numpy.dtype([
('a', numpy.int8),
('c', numpy.float64),
]))
b.copy_from(a.data)
self.assertEqual(len(b), 4)
self.assertEqual(b.data.tolist(), [(4, 902.345), (7, 548.229), (2, 771.031), (8, 858.063),])
评论列表
文章目录