3bb5cd95ac09d62c520aaac9ff4174d1f6250255,tests/test_algos.py,,test_run_weekly,#,109

Before Change


    assert not algo(target)

    target.now = dts[1]
    assert not algo(target)

    // end of week
    target.now = dts[2]
    assert algo(target)

After Change



    algo = algos.RunWeekly()
    // adds the initial day
    backtest = bt.Backtest(
        bt.Strategy("", [algo]),
        data
    )
    target.data = backtest.data

    // end of week
    target.now = dts[2]
    assert not algo(target)

    // new week
    target.now = dts[3]
    assert algo(target)

    algo = algos.RunWeekly(
        run_on_first_date=False,
        run_on_end_of_period=True,
        run_on_last_date=True
    )
    // adds the initial day
    backtest = bt.Backtest(
        bt.Strategy("", [algo]),
        data
    )
    target.data = backtest.data

    // end of week
    target.now = dts[2]
    assert algo(target)

    // new week
    target.now = dts[3]
    assert not algo(target)

    dts = pd.DatetimeIndex([datetime(2016, 1, 3), datetime(2017, 1, 8),datetime(2018, 1, 7)])
    data = pd.DataFrame(index=dts, columns=["c1", "c2"], data=100)
    // adds the initial day
    backtest = bt.Backtest(
        bt.Strategy("", [algo]),
        data
    )
    target.data = backtest.data

    // check next year
    target.now = dts[1]
    assert algo(target)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 21

Instances


Project Name: pmorissette/bt
Commit Name: 3bb5cd95ac09d62c520aaac9ff4174d1f6250255
Time: 2018-04-17
Author: jordan.platts@ahss.org
File Name: tests/test_algos.py
Class Name:
Method Name: test_run_weekly


Project Name: pmorissette/bt
Commit Name: 3bb5cd95ac09d62c520aaac9ff4174d1f6250255
Time: 2018-04-17
Author: jordan.platts@ahss.org
File Name: tests/test_algos.py
Class Name:
Method Name: test_run_monthly


Project Name: pmorissette/bt
Commit Name: 3bb5cd95ac09d62c520aaac9ff4174d1f6250255
Time: 2018-04-17
Author: jordan.platts@ahss.org
File Name: tests/test_algos.py
Class Name:
Method Name: test_run_weekly


Project Name: pmorissette/bt
Commit Name: 3bb5cd95ac09d62c520aaac9ff4174d1f6250255
Time: 2018-04-17
Author: jordan.platts@ahss.org
File Name: tests/test_algos.py
Class Name:
Method Name: test_run_quarterly