Exemplo n.º 1
0
def test_accumulate__end_date(padding, sample_key):
    sd = sample_data[sample_key]
    ts = TimeSeries(sd)
    ts.accumulate(1, "Year", padding=padding)
    assert (ts.get_x()[-1] == expected_end_date(sd[-1][0], padding))
    assert (ts.get_x()[-1].day == 1)
    assert (ts.get_x()[-1].month == 1)
Exemplo n.º 2
0
def test_get_x():
    ts = TimeSeries(sample_data)
    x = ts.get_x()

    #Every value should be equal to the to the first column in ts.data
    for i in range(len(x)):
        assert(x[i]==ts.data[i][0])
Exemplo n.º 3
0
def test_accumulate__end_date(padding, sample_key):
    sd = sample_data[sample_key]
    ts = TimeSeries(sd)
    ts.accumulate(1, "Week", padding=padding)
    assert (ts.get_x()[-1] == expected_end_date(sd[-1][0], padding))
    assert (ts.get_x()[-1].weekday() == 0)
Exemplo n.º 4
0
def test_accumulate__start_date(padding, sample_key):
    sd = sample_data[sample_key]
    ts = TimeSeries(sd)
    ts.accumulate(1, "Month", padding=padding)
    assert (ts.get_x()[0] == expected_start_date(sd[0][0], padding))
    assert (ts.get_x()[0].day == 1)
Exemplo n.º 5
0
def test_accumulate__end_date(padding,sample_key,delta):
    sd = sample_data[sample_key]
    ts = TimeSeries(sd)
    original_len = len(ts.data)
    ts.accumulate(delta,"Day",padding=padding)
    assert(ts.get_x()[-1]==expected_end_date(sd[-1][0],delta,original_len,padding))