This commit is contained in:
@@ -61,6 +61,16 @@ class PlanContractTests(unittest.TestCase):
|
||||
self.assertEqual(plan.kind, PlanKind.TEXT)
|
||||
self.assertEqual(plan.to_mapping(), {"kind": "text", "text": "hello"})
|
||||
|
||||
def test_multi_text_plan_has_bounded_parts(self):
|
||||
plan = ReplyPlan.multi_text(["one", "two"])
|
||||
self.assertEqual(plan.kind, PlanKind.MULTI_TEXT)
|
||||
self.assertEqual(
|
||||
plan.to_mapping(),
|
||||
{"kind": "multi_text", "texts": ["one", "two"]},
|
||||
)
|
||||
restored = ReplyPlan.from_mapping(plan.to_mapping())
|
||||
self.assertEqual(restored, plan)
|
||||
|
||||
def test_no_reply_plan_cannot_contain_text(self):
|
||||
with self.assertRaisesRegex(ContractViolation, "cannot contain text"):
|
||||
ReplyPlan(kind=PlanKind.NO_REPLY, message="unexpected")
|
||||
|
||||
Reference in New Issue
Block a user