Made unit test to test case of #3432

This commit is contained in:
Griatch 2024-02-25 19:47:51 +01:00
parent e5d07603ca
commit 03f71fa87e
2 changed files with 14 additions and 2 deletions

View file

@ -11,11 +11,10 @@ import time
import typing import typing
from collections import defaultdict from collections import defaultdict
import evennia
import inflect import inflect
from django.conf import settings from django.conf import settings
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
import evennia
from evennia.commands import cmdset from evennia.commands import cmdset
from evennia.commands.cmdsethandler import CmdSetHandler from evennia.commands.cmdsethandler import CmdSetHandler
from evennia.objects.manager import ObjectManager from evennia.objects.manager import ObjectManager

View file

@ -114,6 +114,19 @@ class DefaultObjectTest(BaseEvenniaTest):
# partial match to 'colon' - multimatch error since stack is not homogenous # partial match to 'colon' - multimatch error since stack is not homogenous
self.assertEqual(self.char1.search("co", stacked=2), None) self.assertEqual(self.char1.search("co", stacked=2), None)
def test_search_plural_form(self):
"""Test searching for plural form of objects"""
coin1 = DefaultObject.create("coin", location=self.room1)[0]
coin2 = DefaultObject.create("coin", location=self.room1)[0]
coin3 = DefaultObject.create("coin", location=self.room1)[0]
# build the numbered aliases
coin1.get_numbered_name(2, self.char1)
coin2.get_numbered_name(3, self.char1)
coin3.get_numbered_name(4, self.char1)
self.assertEqual(self.char1.search("coin", quiet=True), [coin1, coin2, coin3])
self.assertEqual(self.char1.search("coins", quiet=True), [coin1, coin2, coin3])
def test_get_default_lockstring_base(self): def test_get_default_lockstring_base(self):
pattern = ( pattern = (
f"control:pid({self.account.id}) or id({self.char1.id}) or" f"control:pid({self.account.id}) or id({self.char1.id}) or"