diff --git a/evennia/commands/tests.py b/evennia/commands/tests.py index f0ad139f01..c06962da84 100644 --- a/evennia/commands/tests.py +++ b/evennia/commands/tests.py @@ -1035,7 +1035,7 @@ class TestGetAndMergeCmdSets(TwistedTestCase, BaseEvenniaTest): pcmdset = AccountCmdSet() pcmdset.at_cmdset_creation() pcmds = [cmd.key for cmd in pcmdset.commands] + ["a", "b", "c", "d"] - self.assertTrue(all(cmd.key in pcmds for cmd in cmdset.commands)) + self.assertEqual(set(cmd.key for cmd in cmdset.commands), set(pcmds)) # _callback = lambda cmdset: self.assertEqual(sum(1 for cmd in cmdset.commands if cmd.key in ("a", "b", "c", "d")), 4) deferred.addCallback(_callback) diff --git a/evennia/contrib/game_systems/puzzles/tests.py b/evennia/contrib/game_systems/puzzles/tests.py index 79d3fed228..1138818d44 100644 --- a/evennia/contrib/game_systems/puzzles/tests.py +++ b/evennia/contrib/game_systems/puzzles/tests.py @@ -383,7 +383,7 @@ class TestPuzzles(BaseEvenniaCommandTest): self._use( "steel-1, flint", "You try to utilize these but nothing happens ... something amiss?" ) - self._use("steel-1, flint, red steel, steel-3", "You are a Genius") + self._use("steel-1, flint, red steel, steel-2", "You are a Genius") self._check_room_contents({"smoke": 1, "fire": 1}) _box_all() diff --git a/evennia/objects/manager.py b/evennia/objects/manager.py index aa5cb8e749..9dc451a496 100644 --- a/evennia/objects/manager.py +++ b/evennia/objects/manager.py @@ -476,13 +476,19 @@ class ObjectDBManager(TypedObjectManager): # query - if so, strip it. match = _MULTIMATCH_REGEX.match(str(searchdata)) match_number = None + stripped_searchdata = searchdata if match: # strips the number - match_number, searchdata = match.group("number"), match.group("name") + match_number, stripped_searchdata = match.group("number"), match.group("name") match_number = int(match_number) - 1 - if match_number is not None or not exact: - # run search again, with the exactness set by call - matches = _searcher(searchdata, candidates, typeclass, exact=exact) + if match_number is not None: + # run search against the stripped data + matches = _searcher(stripped_searchdata, candidates, typeclass, exact=True) + if not matches: + # final chance to get a looser match against the number-strippped query + matches = _searcher(stripped_searchdata, candidates, typeclass, exact=False) + elif not exact: + matches = _searcher(searchdata, candidates, typeclass, exact=False) # deal with result if len(matches) == 1 and match_number is not None and match_number != 0: