Fix verb conjugation with unknown verbs. Resolve #3330

This commit is contained in:
Griatch 2023-11-26 17:00:13 +01:00
parent 5d1f93d6bf
commit 89d159cc96
2 changed files with 22 additions and 4 deletions

View file

@ -10,11 +10,10 @@ from ast import literal_eval
from unittest.mock import MagicMock, patch
from django.test import TestCase, override_settings
from evennia.utils import funcparser, test_resources
from parameterized import parameterized
from simpleeval import simple_eval
from evennia.utils import funcparser, test_resources
def _test_callable(*args, **kwargs):
kwargs.pop("funcparser", None)
@ -471,6 +470,23 @@ class TestDefaultCallables(TestCase):
)
self.assertEqual(expected_them, ret)
def test_conjugate__non_existing_verb(self):
"""
Test $conj() but with a nonsense verb. It should just return the verb as-is.
"""
string = "$You() $conj(squanch) greatly."
mapping = {"char1": self.obj1, "char2": self.obj2}
ret = self.parser.parse(
string, caller=self.obj1, receiver=self.obj1, mapping=mapping, raise_errors=True
)
self.assertEqual("You squanch greatly.", ret)
ret = self.parser.parse(
string, caller=self.obj1, receiver=self.obj2, mapping=mapping, raise_errors=True
)
self.assertEqual("Char1 squanchs greatly.", ret)
def test_conjugate_missing_args(self):
string = "You $conj(smile)"
with self.assertRaises(funcparser.ParsingError):