Cleaned up KeyErrors and added a funcparser test.
This commit is contained in:
parent
5fa11cddb6
commit
b975d0fabd
2 changed files with 52 additions and 53 deletions
|
|
@ -1222,10 +1222,7 @@ def funcparser_callable_you(
|
|||
"""
|
||||
if args and mapping:
|
||||
# this would mean a $you(key) form
|
||||
try:
|
||||
caller = mapping.get(args[0])
|
||||
except KeyError:
|
||||
pass
|
||||
caller = mapping.get(args[0], None)
|
||||
|
||||
if not (caller and receiver):
|
||||
raise ParsingError("No caller or receiver supplied to $you callable.")
|
||||
|
|
@ -1292,10 +1289,7 @@ def funcparser_callable_your(
|
|||
"""
|
||||
if args and mapping:
|
||||
# this would mean a $your(key) form
|
||||
try:
|
||||
caller = mapping.get(args[0])
|
||||
except KeyError:
|
||||
pass
|
||||
caller = mapping.get(args[0], None)
|
||||
|
||||
if not (caller and receiver):
|
||||
raise ParsingError("No caller or receiver supplied to $your callable.")
|
||||
|
|
|
|||
|
|
@ -451,6 +451,11 @@ class TestDefaultCallables(TestCase):
|
|||
"You smile to yourself.",
|
||||
"Char1 smiles to herself.",
|
||||
), # reverse reference
|
||||
(
|
||||
"$Your() smile is the greatest ever.",
|
||||
"Your smile is the greatest ever.",
|
||||
"Char1's smile is the greatest ever."
|
||||
),
|
||||
]
|
||||
)
|
||||
def test_conjugate(self, string, expected_you, expected_them):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue