mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Fix gendersub, add new unittest
This commit is contained in:
parent
862d2a5d06
commit
f53db0079c
2 changed files with 6 additions and 2 deletions
|
|
@ -143,9 +143,9 @@ class GenderCharacter(DefaultCharacter):
|
|||
"""
|
||||
try:
|
||||
if text and isinstance(text, tuple):
|
||||
text = (self._RE_GENDER_PRONOUN.sub(self._get_pronoun, text[0]), *text[1:])
|
||||
text = _RE_GENDER_PRONOUN.sub(self._get_pronoun, text[0]), *text[1:]
|
||||
else:
|
||||
text = self._RE_GENDER_PRONOUN.sub(self._get_pronoun, text)
|
||||
text = _RE_GENDER_PRONOUN.sub(self._get_pronoun, text)
|
||||
except TypeError:
|
||||
pass
|
||||
except Exception as e:
|
||||
|
|
|
|||
|
|
@ -946,6 +946,10 @@ class TestGenderSub(CommandTest):
|
|||
self.assertEqual(
|
||||
gendersub._RE_GENDER_PRONOUN.sub(char._get_pronoun, txt), "Test their gender"
|
||||
)
|
||||
with patch("evennia.contrib.gendersub.DefaultCharacter.msg") as mock_msg:
|
||||
char.db.gender = "female"
|
||||
char.msg("Test |p gender")
|
||||
mock_msg.assert_called_with("Test her gender", from_obj=None, session=None)
|
||||
|
||||
|
||||
# test health bar contrib
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue