예제 #1
0
def test_no_overlap(data):
    # test step equals length
    node = Window(length=1, step=None)
    node.i.data = data.next(11)
    node.update()
    o1 = node.o.data
    node.clear()
    node.i.data = data.next(11)
    node.update()
    o2 = node.o.data
    # assert continuity (no repeated samples)
    pd.testing.assert_frame_equal(o1.append(o2), data._data.iloc[0:20])
    # assert window length
    assert len(o2) == 10
예제 #2
0
def test_low_step(data):
    # step lower than length
    node = Window(length=1, step=.2)
    data.reset()
    node.i.data = data.next(11)
    node.update()
    o1 = node.o.data
    node.clear()
    node.i.data = data.next(3)
    node.update()
    o2 = node.o.data
    # assert step size
    assert (o2.index[0] - o1.index[0]).total_seconds() == 0.2
    # assert window length
    assert len(o2) == 10