本文整理汇总了Python中miro.item.Item.set_subtitle_encoding方法的典型用法代码示例。如果您正苦于以下问题:Python Item.set_subtitle_encoding方法的具体用法?Python Item.set_subtitle_encoding怎么用?Python Item.set_subtitle_encoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类miro.item.Item
的用法示例。
在下文中一共展示了Item.set_subtitle_encoding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SubtitleEncodingTest
# 需要导入模块: from miro.item import Item [as 别名]
# 或者: from miro.item.Item import set_subtitle_encoding [as 别名]
class SubtitleEncodingTest(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_default(self):
self.assertEquals(self.item1.subtitle_encoding, None)
def test_set(self):
self.item1.set_subtitle_encoding("latin-1")
self.assertEquals(self.item1.subtitle_encoding, "latin-1")
def test_set_on_watched(self):
# The 1st time an item is marked watched, we should remember the
# subtitle encoding.
self.item1.set_subtitle_encoding("latin-9")
self.assertEquals(self.item2.subtitle_encoding, None)
self.item2.mark_item_seen()
self.assertEquals(self.item2.subtitle_encoding, "latin-9")
# Test the value isn't re-set the next time it's marked watched
self.item1.set_subtitle_encoding("latin-5")
self.item2.mark_item_seen()
self.assertEquals(self.item2.subtitle_encoding, "latin-9")
def test_set_none(self):
# Test an item is marked seen when the subtitle encoding is None)
self.item1.mark_item_seen()
self.assertEquals(self.item2.subtitle_encoding, None)
self.item2.set_subtitle_encoding("latin-7")
self.item2.mark_item_seen()
self.item1.mark_item_seen()
self.assertEquals(self.item1.subtitle_encoding, None)