Пример #1
0
 def test_extend_enlarges_buffer_as_needed(self):
     a = GrowingArray((2, 2), dtype='int', expected_rows=1)
     a.extend(np.array([
         [[1, 2], [3, 4]],
         [[5, 6], [7, 8]]]))
     expected = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
     assert_equal(a.data, expected)
Пример #2
0
 def test_can_extend_data(self):
     a = GrowingArray((2, 2), dtype='int')
     a.extend(np.array([
         [[1, 2], [3, 4]],
         [[5, 6], [7, 8]]]))
     expected = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
     assert_equal(a.data, expected)
Пример #3
0
 def test_raises_exception_when_extending_wrong_shape(self):
     a = GrowingArray((2, 2), dtype='int')
     a.extend(np.array([1, 2]))