mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Fix regression caused by fixing the search_typeclass manager method
This commit is contained in:
parent
6c43b341dc
commit
f1e8ff5965
3 changed files with 13 additions and 9 deletions
|
|
@ -553,6 +553,10 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager):
|
|||
Returns:
|
||||
objects (list): The objects found with the given typeclasses.
|
||||
|
||||
Raises:
|
||||
ImportError: If the provided `typeclass` is not a valid typeclass or the
|
||||
path to an existing typeclass.
|
||||
|
||||
"""
|
||||
if not callable(typeclass):
|
||||
typeclass = class_from_module(typeclass)
|
||||
|
|
|
|||
|
|
@ -245,8 +245,8 @@ class TestSearchTypeclassFamily(EvenniaTestCase):
|
|||
res2 = self.obj1.__class__.objects.typeclass_search(
|
||||
"evennia.typeclasses.tests.TestSearchManagerTypeclass"
|
||||
)
|
||||
self.assertEqual(list(res1), [self.obj1, self.obj2])
|
||||
self.assertEqual(list(res2), [self.obj1, self.obj2])
|
||||
self.assertEqual(set(res1), {self.obj1, self.obj2})
|
||||
self.assertEqual(set(res2), {self.obj1, self.obj2})
|
||||
|
||||
def test_typeclass_search__children_and_parents(self):
|
||||
"""Test getting parents/child classes"""
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
from evennia.scripts.scripts import DefaultScript
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia import DefaultObject, DefaultRoom
|
||||
from evennia.objects.models import ObjectDB
|
||||
from evennia.scripts.scripts import DefaultScript
|
||||
from evennia.utils.search import (
|
||||
search_script,
|
||||
search_script_attribute,
|
||||
search_script_tag,
|
||||
search_script,
|
||||
search_typeclass,
|
||||
)
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
|
||||
|
||||
class TestSearch(EvenniaTest):
|
||||
|
|
@ -71,12 +71,12 @@ class TestSearch(EvenniaTest):
|
|||
|
||||
def test_search_typeclass(self):
|
||||
"""Check that an object can be found by typeclass"""
|
||||
obj = DefaultObject.create("test_obj")
|
||||
DefaultObject.create("test_obj")
|
||||
found = search_typeclass("evennia.objects.objects.DefaultObject")
|
||||
self.assertEqual(len(found), 1)
|
||||
|
||||
def test_search_wrong_typeclass(self):
|
||||
"""Check that an object cannot be found by wrong typeclass"""
|
||||
obj = DefaultObject.create("test_obj_2")
|
||||
found = search_typeclass("not.a.typeclass")
|
||||
self.assertEqual(len(found), 0)
|
||||
DefaultObject.create("test_obj_2")
|
||||
with self.assertRaises(ImportError):
|
||||
search_typeclass("not.a.typeclass")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue