def test_epic_market_open(self, market_open): fs = FrameSetFactory() epic = EpicFactory() epic.market_open = market_open fs.epic = epic assert fs.epic_market_open == market_open
def test_indicators_not_empty(self, mocker): epic_mock = mocker.Mock() epic_mock.market_open = True parent_framset = FrameSetFactory() indicator_mock = mocker.Mock() indicator_mock.ref = "my_indicator_ref" indicator_mock.build_value_from_frame.return_value = "indicator_value" parent_framset.epic = epic_mock parent_framset.add_indicator(indicator_mock) fr = FrameFactory(parent_frameset=parent_framset) assert fr.indicators == {"my_indicator_ref": "indicator_value"}
def test_indicators_on_new_tick_called__indicator_none( self, mocker, market_open): epic_mock = mocker.Mock() epic_mock.market_open = market_open parent_framset = FrameSetFactory() indicator_mock = mocker.Mock() indicator_mock.ref = "my_indicator_ref" parent_framset.epic = epic_mock parent_framset.add_indicator(indicator_mock) fr = FrameFactory(parent_frameset=parent_framset) fr.indicators = {"my_indicator_ref": None} tick = TickFactory() fr.on_new_tick(tick) assert indicator_mock.build_value_from_frame.call_args_list == [ call(fr, market_open), # call on Frame Init call(fr, market_open), ]
def test_no_epic(self): fs = FrameSetFactory() fs.epic = None assert fs.epic_market_open is False