def test_get_strategy_inputs(self): dummy_strategy = Strategy(name="dummy", parent=None) def temp(): return 3, 4, 5 dummy_strategy.get_params = temp self.assertEqual(dummy_strategy.get_params(), (3, 4, 5)) self.trader.strategies = {'dummy': dummy_strategy} self.assertEqual(self.trader.get_strategy_inputs('dummy'), '3, 4, 5')
def test_get_strategy_inputs(trader: Trader): """ Test trader get strategy inputs functionality. :param trader: Trader object. """ dummy_strategy = Strategy(name="dummy", parent=None) def temp(): return 3, 4, 5 dummy_strategy.get_params = temp assert dummy_strategy.get_params() == (3, 4, 5) trader.strategies = {'dummy': dummy_strategy} assert trader.get_strategy_inputs('dummy') == '3, 4, 5'
def test_get_strategies_info_string(self): dummy_strategy = Strategy(name="dummy", parent=None) dummy_strategy2 = Strategy(name='dummy2', parent=None) def temp(): return 3, 4, 5 def temp2(): return 5, 6, 7, 8, 9, 10 dummy_strategy.get_params = temp dummy_strategy2.get_params = temp2 expected_string = '\nStrategies:\n\tDummy: 3, 4, 5\n\tDummy2: 5, 6, 7, 8, 9, 10' self.trader.strategies = {'dummy': dummy_strategy, 'dummy2': dummy_strategy2} self.assertEqual(self.trader.get_strategies_info_string(), expected_string)
def test_get_strategies_info_string(trader: Trader): """ Test trader get strategies info string functionality. :param trader: Trader object. """ dummy_strategy = Strategy(name="dummy", parent=None) dummy_strategy2 = Strategy(name='dummy2', parent=None) def temp(): return 3, 4, 5 def temp2(): return 5, 6, 7, 8, 9, 10 dummy_strategy.get_params = temp dummy_strategy2.get_params = temp2 expected_string = 'Strategies:\n\tDummy: 3, 4, 5\n\tDummy2: 5, 6, 7, 8, 9, 10' trader.strategies = {'dummy': dummy_strategy, 'dummy2': dummy_strategy2} assert trader.get_strategies_info_string() == expected_string