Пример #1
0
 def test_verify_object_name_state__valid_name__returns_ask_clear_table_state(self):
     validate_task_state = dialog_flow.VerifyObjectNameState(self.state_dict, self.container)
     validate_task_state.is_first_call = False
     validate_task_state.state_dict["last_received_sentence"] = "A pcb"
     test_entities = [(EntityType.OBJECT, "pcb")]
     self.container.ner.get_entities = Mock(return_value=test_entities)
     self.container.speak = Mock()
     self.container.grounding.db.object_exists = Mock(return_value=False)
     return_state = validate_task_state.execute()
     self.assertTrue(isinstance(return_state, dialog_flow.AskClearTableState))
Пример #2
0
 def test_verify_object_name_state__invalid_name__returns_self(self):
     validate_task_state = dialog_flow.VerifyObjectNameState(self.state_dict, self.container)
     validate_task_state.is_first_call = False
     validate_task_state.state_dict["last_received_sentence"] = "On top of the table"
     test_entities = [(EntityType.LOCATION, "")]
     self.container.ner.get_entities = Mock(return_value=test_entities)
     self.container.speak = Mock()
     return_state = validate_task_state.execute()
     self.assertTrue(isinstance(return_state, dialog_flow.VerifyObjectNameState))
     self.assertTrue(validate_task_state.is_first_call)
Пример #3
0
 def test_verify_object_name_state__multiple_names__returns_self(self):
     validate_task_state = dialog_flow.VerifyObjectNameState(self.state_dict, self.container)
     validate_task_state.is_first_call = False
     validate_task_state.state_dict["last_received_sentence"] = "A screwdriver and a blue hammer"
     test_entities = [(EntityType.OBJECT, "screwdriver"),(EntityType.OBJECT, "hammer")]
     self.container.ner.get_entities = Mock(return_value=test_entities)
     self.container.speak = Mock()
     return_state = validate_task_state.execute()
     self.assertTrue(isinstance(return_state, dialog_flow.VerifyObjectNameState))
     self.assertTrue(validate_task_state.is_first_call)
Пример #4
0
 def test_verify_object_name_state__first_call__returns_wait(self):
     validate_task_state = dialog_flow.VerifyObjectNameState(self.state_dict, self.container)
     self.container.speak = Mock()
     return_state = validate_task_state.execute()
     self.assertTrue(isinstance(return_state, dialog_flow.WaitForResponseState))