def segregate_and_react(self): if not self.check_if_greeting(): grammifier = Grammifier(self.words) print("Referrer is %s" % grammifier.get_referrer()) mental_state = grammifier.get_stemmed_mental_state() action_type = grammifier.get_action_type() strategist = Strategist(strategies) strategist.get_strategy_for(mental_state, action_type)
def segregate_and_react(self): action_controller = ActionController(self.words) if not self.check_if_greeting() and not action_controller.check_if_action(): grammifier = Grammifier(self.words) print("Referrer is %s" % grammifier.get_referrer()) mental_state = grammifier.get_stemmed_mental_state() action_type = grammifier.get_action_type() strategist = Strategist(strategies) strategist.get_strategy_for(mental_state, action_type) elif action_controller.check_if_action(): mode = action_controller.get_mode() device = action_controller.get_device() strategist = Strategist(strategies) strategist.get_strategy_for(mode, device)
def segregate_and_react(self): action_controller = ActionController(self.words) if not self.check_if_greeting( ) and not action_controller.check_if_action(): grammifier = Grammifier(self.words) print("Referrer is %s" % grammifier.get_referrer()) mental_state = grammifier.get_stemmed_mental_state() action_type = grammifier.get_action_type() strategist = Strategist(strategies) strategist.get_strategy_for(mental_state, action_type) elif action_controller.check_if_action(): mode = action_controller.get_mode() device = action_controller.get_device() strategist = Strategist(strategies) strategist.get_strategy_for(mode, device)
class StrategistTestCase(unittest.TestCase): def setUp(self): self.strategist = Strategist(strategies) def tearDown(self): del self.strategist def test_should_return_list_of_strategies(self): expected_list = self.strategist.get_strategy_for("feel", "bored") self.assertTrue(isinstance(expected_list[0], PlayMusic)) self.assertTrue(isinstance(expected_list[1], StartTV))