def test_anterior_tick(self): epic = EpicFactory() last_tick = TickFactory(datetime=arrow.get("2020-01-01 12:34:56")) epic.last_tick = last_tick new_tick = TickFactory(datetime=arrow.get("2020-01-01 12:34:55")) with pytest.raises(EpicException): epic.on_new_tick(new_tick)
def test_call_close_from_tick(self, mock_close_from_tick): epic = EpicFactory() trade = TradeFactory(epic=epic) last_tick = TickFactory() epic.last_tick = last_tick trade.close_from_epic() assert mock_close_from_tick.call_args_list == [call(last_tick)]