本文整理汇总了Python中miro.item.Item.set_title方法的典型用法代码示例。如果您正苦于以下问题:Python Item.set_title方法的具体用法?Python Item.set_title怎么用?Python Item.set_title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类miro.item.Item
的用法示例。
在下文中一共展示了Item.set_title方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ItemSearchTest
# 需要导入模块: from miro.item import Item [as 别名]
# 或者: from miro.item.Item import set_title [as 别名]
class ItemSearchTest(MiroTestCase):
def setUp(self):
MiroTestCase.setUp(self)
self.feed = Feed(u'http://example.com/1')
self.item1 = Item(fp_values_for_url(u'http://example.com/1/item1'),
feed_id=self.feed.id)
self.item2 = Item(fp_values_for_url(u'http://example.com/1/item2'),
feed_id=self.feed.id)
def test_matches_search(self):
self.item1.set_title(u"miro is cool")
self.assertEquals(self.item1.matches_search('miro'), True)
self.assertEquals(self.item1.matches_search('iro'), True)
self.assertEquals(self.item1.matches_search('c'), True)
self.assertEquals(self.item1.matches_search('miro is'), True)
self.assertEquals(self.item1.matches_search('ool m'), True)
self.assertEquals(self.item1.matches_search('miros'), False)
self.assertEquals(self.item1.matches_search('iscool'), False)
self.assertEquals(self.item1.matches_search('cool -miro'), False)
def test_strips_tags(self):
# Only feeds created with a title get the tags stripped in the title.
# When using item.set_title() no tags are stripped.
f1 = Feed(u'http://example.com/1')
item = Item(fp_values_for_url(u'http://example.com/1/item1', {'title':u"<em>miro</em>"}), feed_id=f1.id)
self.assertEquals(item.matches_search('miro'), True)
self.assertEquals(item.matches_search('<em'), False)
self.assertEquals(item.matches_search('em>'), False)
self.assertEquals(item.matches_search('<em>miro</miro'), False)
示例2: ItemSearchTest
# 需要导入模块: from miro.item import Item [as 别名]
# 或者: from miro.item.Item import set_title [as 别名]
class ItemSearchTest(MiroTestCase):
def setUp(self):
MiroTestCase.setUp(self)
self.feed = Feed(u"http://example.com/1")
self.item1 = Item(fp_values_for_url(u"http://example.com/1/item1"), feed_id=self.feed.id)
self.item2 = Item(fp_values_for_url(u"http://example.com/1/item2"), feed_id=self.feed.id)
def test_matches_search(self):
self.item1.set_title(u"miro is cool")
self.assertEquals(self.item1.matches_search("miro"), True)
self.assertEquals(self.item1.matches_search("iro"), True)
self.assertEquals(self.item1.matches_search("c"), True)
self.assertEquals(self.item1.matches_search("miro is"), True)
self.assertEquals(self.item1.matches_search("ool m"), True)
self.assertEquals(self.item1.matches_search("miros"), False)
self.assertEquals(self.item1.matches_search("iscool"), False)
self.assertEquals(self.item1.matches_search("cool -miro"), False)
def test_strips_tags(self):
# Only feeds created with a title get the tags stripped in the title.
# When using item.set_title() no tags are stripped.
f1 = Feed(u"http://example.com/1")
item = Item(fp_values_for_url(u"http://example.com/1/item1", {"title": u"<em>miro</em>"}), feed_id=f1.id)
self.assertEquals(item.matches_search("miro"), True)
self.assertEquals(item.matches_search("<em"), False)
self.assertEquals(item.matches_search("em>"), False)
self.assertEquals(item.matches_search("<em>miro</miro"), False)