Skip to content

Commit e9333e4

Browse files
committed
New test case, testing combined 'valid_strings' with 'suffixes'
1 parent 36374fb commit e9333e4

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/core/entity_parsing/test_entity_fields/test_entity_parsing.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,37 @@ class IntentClass(ImplementedTestIntent):
6868
grass_color = TextEntityField(suffixes=("grass",))
6969

7070

71+
class PyttmanIntentInternalEntityParserTestTwoTextFieldsWithPrefixes(
72+
PyttmanInternalTestBaseCase
73+
):
74+
process_message = True
75+
mock_message = Message("Adam and Eve were out walking on green grass")
76+
expected_entities = {
77+
"person_one_fail": None,
78+
"person_one": "Adam",
79+
"person_two": "Eve",
80+
"grass_color": "green"
81+
}
82+
83+
class IntentClass(ImplementedTestIntent):
84+
"""
85+
Test a combination of custom Identifier class for a TextEntityField
86+
with valid_strings, message_contains all in combinations.
87+
prefixed should denote that the entity isn't found.
88+
"""
89+
valid_strings = ("Adam", "Eve")
90+
lead = ("walking",)
91+
person_one_fail = TextEntityField(identifier=CapitalizedIdentifier,
92+
valid_strings=valid_strings,
93+
prefixes=("_prefix_",))
94+
person_one = TextEntityField(identifier=CapitalizedIdentifier,
95+
valid_strings=valid_strings)
96+
person_two = TextEntityField(identifier=CapitalizedIdentifier,
97+
valid_strings=valid_strings,
98+
suffixes=("were",))
99+
grass_color = TextEntityField(suffixes=("grass",))
100+
101+
71102
class PyttmanIntentInternalEntityParserTestBookKeeperApp(
72103
PyttmanInternalTestBaseCase
73104
):

0 commit comments

Comments
 (0)