mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 12:56:30 +01:00
minor cleanup
This commit is contained in:
parent
d7d6b311ec
commit
fdfb2019cf
2 changed files with 2 additions and 8 deletions
|
|
@ -479,12 +479,7 @@ class ObjectDBManager(TypedObjectManager):
|
|||
|
||||
# deal with result
|
||||
if match_number is not None:
|
||||
# this indicates someone attempting to get a single match with a match-number
|
||||
if match_number >= len(matches):
|
||||
# the search attempted to target a higher match index than exists in the candidates.
|
||||
# This leads to a no-match.
|
||||
matches = self.none()
|
||||
elif 0 <= match_number < len(matches):
|
||||
if 0 <= match_number < len(matches):
|
||||
# limit to one match (we still want a queryset back)
|
||||
# NOTE: still haven't found a way to avoid a second lookup
|
||||
matches = self.filter(id=matches[match_number].id)
|
||||
|
|
|
|||
|
|
@ -250,11 +250,10 @@ class TestObjectManager(BaseEvenniaTest):
|
|||
def test_get_objs_with_key_or_alias(self):
|
||||
query = ObjectDB.objects.get_objs_with_key_or_alias("Char")
|
||||
self.assertEqual(list(query), [self.char1])
|
||||
self.assertEqual(list(query), [self.char1])
|
||||
query = ObjectDB.objects.get_objs_with_key_or_alias(
|
||||
"Char", typeclasses="evennia.objects.objects.DefaultObject"
|
||||
)
|
||||
self.assertFalse(query)
|
||||
self.assertEqual(list(query), [])
|
||||
query = ObjectDB.objects.get_objs_with_key_or_alias(
|
||||
"Char", candidates=[self.char1, self.char2]
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue