From e834e34fd155ceaec733caedb89d2b772b999cce Mon Sep 17 00:00:00 2001 From: Count Infinity Date: Wed, 19 Nov 2025 00:18:31 -0700 Subject: [PATCH] Add searchable --- evennia/prototypes/tests.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/evennia/prototypes/tests.py b/evennia/prototypes/tests.py index 1422c58d40..362ef8bcf1 100644 --- a/evennia/prototypes/tests.py +++ b/evennia/prototypes/tests.py @@ -1047,18 +1047,19 @@ class TestIssue2908(BaseEvenniaTest): class TestIssue3824(BaseEvenniaTest): """ - Test that $obj, $objlist, and $search callables work correctly when spawning prototypes. + Test that $obj, $objlist, $search, and $dbref callables work correctly when spawning prototypes. + Regression test for bug where 'prototype' kwarg was passed to search functions causing TypeError. """ def test_spawn_with_search_callables(self): - """Test spawning prototype with $obj, $objlist, and $search callables.""" + """Test spawning prototype with $obj, $objlist, $search, and $dbref callables.""" # Setup: tag some objects for searching self.room1.tags.add("test_location", category="zone") self.room2.tags.add("test_location", category="zone") self.obj1.tags.add("test_item", category="item_type") - # Create prototype using all three search callables + # Create prototype using all search callables prot = { "prototype_key": "test_search_callables", "typeclass": "evennia.objects.objects.DefaultObject", @@ -1066,6 +1067,7 @@ class TestIssue3824(BaseEvenniaTest): "attr_obj": f"$obj({self.obj1.dbref})", "attr_search": "$search(Char)", "attr_objlist": "$objlist(test_location, category=zone, type=tag)", + "attr_dbref": f"$dbref({self.obj1.dbref})", } # This should not raise TypeError about 'prototype' kwarg @@ -1077,13 +1079,13 @@ class TestIssue3824(BaseEvenniaTest): # Verify all search callables worked correctly self.assertEqual(obj.db.attr_obj, self.obj1) self.assertEqual(obj.db.attr_search, self.char1) + self.assertEqual(obj.db.attr_dbref, self.obj1) # attr_objlist should be a list or list-like object with 2 rooms objlist = obj.db.attr_objlist self.assertEqual(len(objlist), 2) self.assertIn(self.room1, objlist) self.assertIn(self.room2, objlist) - class TestIssue3101(EvenniaCommandTest): """ Spawning and using create_object should store the same `typeclass_path` if using