本文整理汇总了Python中chatterbot.conversation.Statement.get_tags方法的典型用法代码示例。如果您正苦于以下问题:Python Statement.get_tags方法的具体用法?Python Statement.get_tags怎么用?Python Statement.get_tags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chatterbot.conversation.Statement
的用法示例。
在下文中一共展示了Statement.get_tags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: StatementIntegrationTestCase
# 需要导入模块: from chatterbot.conversation import Statement [as 别名]
# 或者: from chatterbot.conversation.Statement import get_tags [as 别名]
class StatementIntegrationTestCase(TestCase):
"""
Test case to make sure that the Django Statement model
and ChatterBot Statement object have a common interface.
"""
def setUp(self):
super().setUp()
from datetime import datetime
from pytz import UTC
now = datetime(2020, 2, 15, 3, 14, 10, 0, UTC)
self.object = StatementObject(text='_', created_at=now)
self.model = StatementModel(text='_', created_at=now)
# Simulate both statements being saved
self.model.save()
self.object.id = self.model.id
def test_text(self):
self.assertTrue(hasattr(self.object, 'text'))
self.assertTrue(hasattr(self.model, 'text'))
def test_in_response_to(self):
self.assertTrue(hasattr(self.object, 'in_response_to'))
self.assertTrue(hasattr(self.model, 'in_response_to'))
def test_conversation(self):
self.assertTrue(hasattr(self.object, 'conversation'))
self.assertTrue(hasattr(self.model, 'conversation'))
def test_tags(self):
self.assertTrue(hasattr(self.object, 'tags'))
self.assertTrue(hasattr(self.model, 'tags'))
def test__str__(self):
self.assertTrue(hasattr(self.object, '__str__'))
self.assertTrue(hasattr(self.model, '__str__'))
self.assertEqual(str(self.object), str(self.model))
def test_add_tags(self):
self.object.add_tags('a', 'b')
self.model.add_tags('a', 'b')
self.assertIn('a', self.object.get_tags())
self.assertIn('a', self.model.get_tags())
def test_serialize(self):
object_data = self.object.serialize()
model_data = self.model.serialize()
self.assertEqual(object_data, model_data)