Ejemplo n.º 1
0
def test_days_slice():
    rate = Rate('rate(2 days)')
    rate.now = datetime(year=2018, month=2, day=11, hour=12)

    expected = [
        datetime(year=2018, month=2, day=13),
        datetime(year=2018, month=2, day=15),
    ]
    assert rate.get_next(count=2) == expected
Ejemplo n.º 2
0
def test_day():
    rate = Rate('rate(1 day)')
    rate.now = datetime(year=2018, month=2, day=11, hour=12)

    expected = [datetime(year=2018, month=2, day=12)]
    assert rate.get_next() == expected
Ejemplo n.º 3
0
def test_invalid_day():
    rate = Rate('rate(1 day)')
    rate.now = datetime(year=2018, month=2, day=11, hour=12)

    with pytest.raises(ValueError):
        result = rate.get_next(1, 2)