def test_give_command_item_not_in_inventory(self): user_input = ["give", "testman", "test not present"] player = copy.copy(Test_Objects.TEST_PLAYER_IN_INVISIBLE_PERSON_ROOM) actual = Commands.parse_give_command(user_input, player) expected = Constants.ITEM_NOT_IN_INVENTORY_STRING + "test not present." self.assertEqual(expected, actual)
def test_give_command_with_keyword(self): user_input = ["give", "testman", "keyword"] player = copy.copy(Test_Objects.TEST_PLAYER_IN_PERSON_ROOM) actual = Commands.parse_give_command(user_input, player) self.assertEqual(Constants.INCORRECT_GIFT, actual)
def test_give_command_person_not_present(self): user_input = ["give", "testman", "test"] player = copy.copy(Test_Objects.TEST_PLAYER) actual = Commands.parse_give_command(user_input, player) expected = Constants.PERSON_NOT_VISIBLE_STRING + "testman." self.assertEqual(expected, actual)
def parse_double_target_command(user_input, player): command = user_input[0] if command in Constants.GIVE: return Commands.parse_give_command(user_input, player) return Constants.INVALID_COMMAND_GIVEN_STRING