MCPcopy Create free account
hub / github.com/kernc/backtesting.py / test_resample

Method test_resample

backtesting/test/_test.py:772–786  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

770 time.sleep(1)
771
772 def test_resample(self):
773 class S(SmaCross):
774 def init(self):
775 self.I(lambda: ['x'] * len(self.data)) # categorical indicator, GH-309
776 super().init()
777
778 bt = Backtest(GOOG, S)
779 bt.run()
780 import backtesting._plotting
781 with _tempfile() as f, \
782 patch(backtesting._plotting, '_MAX_CANDLES', 10), \
783 self.assertWarns(UserWarning):
784 bt.plot(filename=f, resample=True)
785 # Give browser time to open before tempfile is removed
786 time.sleep(1)
787
788 def test_indicator_name(self):
789 test_self = self

Callers

nothing calls this directly

Calls 5

runMethod · 0.95
plotMethod · 0.95
BacktestClass · 0.90
patchFunction · 0.90
_tempfileFunction · 0.85

Tested by

no test coverage detected