mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Merge pull request #3453 from chiizujin/disambiguation
Fix aliases not being shown for disambiguation
This commit is contained in:
commit
a5a4d98093
2 changed files with 16 additions and 6 deletions
|
|
@ -6,6 +6,7 @@ import time
|
|||
|
||||
from anything import Anything
|
||||
from evennia import DefaultObject, create_object, default_cmds
|
||||
from evennia.commands.default import building
|
||||
from evennia.commands.default.tests import BaseEvenniaCommandTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
|
||||
|
|
@ -413,10 +414,9 @@ class TestRPSystemCommands(BaseEvenniaCommandTest):
|
|||
|
||||
expected_first_call = [
|
||||
"More than one match for 'Mushroom' (please narrow target):",
|
||||
f" Mushroom-1 []",
|
||||
f" Mushroom-2 []",
|
||||
f" Mushroom-1",
|
||||
f" Mushroom-2",
|
||||
]
|
||||
|
||||
self.call(default_cmds.CmdLook(), "Mushroom", "\n".join(expected_first_call)) # PASSES
|
||||
|
||||
expected_second_call = f"Mushroom(#{mushroom1.id})\nThe first mushroom is brown."
|
||||
|
|
@ -424,3 +424,13 @@ class TestRPSystemCommands(BaseEvenniaCommandTest):
|
|||
|
||||
expected_third_call = f"Mushroom(#{mushroom2.id})\nThe second mushroom is red."
|
||||
self.call(default_cmds.CmdLook(), "Mushroom-2", expected_third_call) # FAILS
|
||||
|
||||
expected_fourth_call = "Alias(es) for 'Mushroom' set to 'fungus'."
|
||||
self.call(building.CmdSetObjAlias(), "Mushroom-1 = fungus", expected_fourth_call) #PASSES
|
||||
|
||||
expected_fifth_call = [
|
||||
"More than one match for 'Mushroom' (please narrow target):",
|
||||
f" Mushroom-1 [fungus]",
|
||||
f" Mushroom-2",
|
||||
]
|
||||
self.call(default_cmds.CmdLook(), "Mushroom", "\n".join(expected_fifth_call)) # PASSES
|
||||
|
|
|
|||
|
|
@ -2403,9 +2403,9 @@ def at_search_result(matches, caller, query="", quiet=False, **kwargs):
|
|||
aliases = result.aliases.all(return_objs=True)
|
||||
# remove pluralization aliases
|
||||
aliases = [
|
||||
alias
|
||||
alias.db_key
|
||||
for alias in aliases
|
||||
if hasattr(alias, "category") and alias.category not in ("plural_key",)
|
||||
if alias.db_category != "plural_key"
|
||||
]
|
||||
else:
|
||||
# result is likely a Command, where `.aliases` is a list of strings.
|
||||
|
|
@ -2416,7 +2416,7 @@ def at_search_result(matches, caller, query="", quiet=False, **kwargs):
|
|||
name=result.get_display_name(caller)
|
||||
if hasattr(result, "get_display_name")
|
||||
else query,
|
||||
aliases=" [{alias}]".format(alias=";".join(aliases) if aliases else ""),
|
||||
aliases=" [{alias}]".format(alias=";".join(aliases)) if aliases else "",
|
||||
info=result.get_extra_info(caller),
|
||||
)
|
||||
matches = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue