def test_series_basic(): # Make series from buffer a1 = np.arange(10, dtype=np.float64) series = Series(a1) assert len(series) == 10 np.testing.assert_equal(series.to_array(), np.hstack([a1])) # Add new buffer a2 = np.arange(5) series = series.append(a2) assert len(series) == 15 np.testing.assert_equal(series.to_array(), np.hstack([a1, a2])) # Ensure appending to previous buffer a3 = np.arange(3) series = series.append(a3) assert len(series) == 18 a4 = np.hstack([a1, a2, a3]) np.testing.assert_equal(series.to_array(), a4)
def test_series_append(): a1 = np.arange(10, dtype=np.float64) series = Series(a1) # Add new buffer a2 = np.arange(5) series = series.append(a2) assert len(series) == 15 np.testing.assert_equal(series.to_array(), np.hstack([a1, a2])) # Ensure appending to previous buffer a3 = np.arange(3) series = series.append(a3) assert len(series) == 18 a4 = np.hstack([a1, a2, a3]) np.testing.assert_equal(series.to_array(), a4) # Appending different dtype a5 = np.array([1, 2, 3], dtype=np.int32) a6 = np.array([4.5, 5.5, 6.5], dtype=np.float64) series = Series(a5).append(a6) np.testing.assert_equal(series.to_array(), np.hstack([a5, a6])) series = Series(a6).append(a5) np.testing.assert_equal(series.to_array(), np.hstack([a6, a5]))
def test_series_basic(): # Make series from buffer a1 = np.arange(10, dtype=np.float64) series = Series(a1) assert len(series) == 10 np.testing.assert_equal(series.to_array(), np.hstack([a1]))