def test_append_enlarges_buffer_as_needed(self): a = GrowingArray((2, 2), dtype='int', expected_rows=1) a.append(np.array([[1, 2], [3, 4]])) a.append(np.array([[5, 6], [7, 8]])) expected = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) assert_equal(a.data, expected)
def test_raises_exception_when_appending_wrong_shape(self): a = GrowingArray((2, 2), dtype='int') a.append(np.array([1, 2]))
def test_can_append_data(self): a = GrowingArray((2, 2), dtype='int') a.append(np.array([[1, 2], [3, 4]])) a.append(np.array([[5, 6], [7, 8]])) expected = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) assert_equal(a.data, expected)