本文整理汇总了Python中chatterbot.conversation.Statement.add_signature方法的典型用法代码示例。如果您正苦于以下问题:Python Statement.add_signature方法的具体用法?Python Statement.add_signature怎么用?Python Statement.add_signature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chatterbot.conversation.Statement
的用法示例。
在下文中一共展示了Statement.add_signature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: StatementTests
# 需要导入模块: from chatterbot.conversation import Statement [as 别名]
# 或者: from chatterbot.conversation.Statement import add_signature [as 别名]
class StatementTests(TestCase):
def setUp(self):
self.statement = Statement("A test statement.")
def test_equality(self):
"""
It should be possible to check if a statement
exists in the list of statements that another
statement has been issued in response to.
"""
self.statement.add_response(Statement("Yo"))
self.assertEqual(len(self.statement.in_response_to), 1)
self.assertIn(
Statement("Yo"),
self.statement.in_response_to
)
def test_occurrence_count(self):
self.statement.update_occurrence_count()
self.assertTrue(
self.statement.get_occurrence_count(),
2
)
def test_update_response_list_new(self):
new_statement = Statement("Hello")
self.statement.add_response(new_statement)
self.assertTrue(
len(self.statement.in_response_to),
1
)
def test_update_response_list_existing(self):
previous_statement = Statement("Hello")
self.statement.add_response(previous_statement)
self.statement.add_response(previous_statement)
self.assertTrue(
len(self.statement.in_response_to),
1
)
def test_add_signature(self):
signature = Signature("Gunther Cox")
self.statement.add_signature(signature)
self.assertIn(signature, self.statement.signatures)
def test_serializer(self):
data = self.statement.serialize()
self.assertEqual(self.statement.text, data["text"])