def test_timeserie_tochannel():
    a = TimeSerie([-2, -1, 0, 1, 2, 3, 4, 5], name="a", fs=1, t0=3)
    b = TimeSerie.empty(0, 20, fs=1)
    a.to_channel(b)
    assert len(a) == 20
    assert a.t0 == 0
    assert a.te == 19
    assert a.at(3) == -2
    assert a.at(4) == -1
    assert a.at(5) == 0
    assert a.at(6) == 1
    assert a.at(7) == 2
    assert a.at(8) == 3
    assert a.at(9) == 4
    assert a.at(10) == 5
    c = TimeSerie([-2, -1, 0, 1, 2, 3, 4, 5], name="a", fs=1, t0=3)
    d = TimeSerie.empty(0, 20, fs=2)
    with pytest.raises(ValueError):
        c.to_channel(d)
    e = TimeSerie([-2, -1, 0, 1, 2, 3, 4, 5], name="a", fs=1, t0=3)
    f = TimeSerie.empty(4, 20, fs=1)
    with pytest.raises(DataLossError):
        e.to_channel(f)
    g = TimeSerie([-2, -1, 0, 1, 2, 3, 4, 5], name="a", fs=1, t0=3)
    h = TimeSerie.empty(0, 8, fs=1)
    with pytest.raises(DataLossError):
        g.to_channel(h)
    i = TimeSerie([-2, -1, 0, 1, 2, 3, 4, 5], name="a", fs=1, t0=3)
    j = TimeSerie.empty(0.5, 20.5, fs=1)
    with pytest.raises(ValueError):
        i.to_channel(j)
    return True
def test_timeserie_at():
    a = TimeSerie([1, 2, 3, 4, 5, 6], t0=1, fs=1, name="a")
    assert a.at(2) == 2
    return True