def test_ask_for_command__previous_greet_first_run__returns_wait_for_command_state( self): greet_state = dialog_flow.GreetState(self.state_dict, self.container) ask_for_command_state = dialog_flow.AskForCommandState( self.state_dict, self.container, greet_state) self.container.speak = Mock() return_state = ask_for_command_state.execute() self.assertTrue( isinstance(return_state, dialog_flow.WaitForResponseState))
def test_ask_for_command__has_teach__returns_start_teach_state(self): entities = [(EntityType.COLOUR, "blue"), (EntityType.TASK, "cover"), (EntityType.TEACH, "next"), (EntityType.LOCATION, "black"), (EntityType.OBJECT, "bottom cover"), (EntityType.LOCATION, "above"), (EntityType.OBJECT, "bottom cover")] ask_for_command_state = dialog_flow.AskForCommandState( self.state_dict, self.container) ask_for_command_state.is_first_call = False self.container.speak = Mock() self.container.ner.get_entities = Mock(return_value=entities) ask_for_command_state.state_dict[ "last_received_sentence"] = "Dummy sentence" return_state = ask_for_command_state.execute() self.assertTrue(isinstance(return_state, dialog_flow.StartTeachState))
def test_ask_for_command__denial__returns_wait_greet_state(self): entities = [(EntityType.DENIAL, "blue"), (EntityType.LOCATION, "cover"), (EntityType.OBJECT, "next"), (EntityType.LOCATION, "black"), (EntityType.OBJECT, "bottom cover"), (EntityType.LOCATION, "above"), (EntityType.OBJECT, "bottom cover")] ask_for_command_state = dialog_flow.AskForCommandState( self.state_dict, self.container) ask_for_command_state.is_first_call = False self.container.speak = Mock() self.container.ner.get_entities = Mock(return_value=entities) ask_for_command_state.state_dict[ "last_received_sentence"] = "Dummy sentence" return_state = ask_for_command_state.execute() self.assertTrue( isinstance(return_state, dialog_flow.WaitForGreetingState))