| 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 |