本文整理匯總了Python中pywikibot.proofreadpage.IndexPage._cached方法的典型用法代碼示例。如果您正苦於以下問題:Python IndexPage._cached方法的具體用法?Python IndexPage._cached怎麽用?Python IndexPage._cached使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pywikibot.proofreadpage.IndexPage
的用法示例。
在下文中一共展示了IndexPage._cached方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_check_if_cached
# 需要導入模塊: from pywikibot.proofreadpage import IndexPage [as 別名]
# 或者: from pywikibot.proofreadpage.IndexPage import _cached [as 別名]
def test_check_if_cached(self, key):
"""Test if cache is checked and loaded properly."""
data = self.sites[key]
index_page = IndexPage(self.site, self.sites[key]['index'])
num, title_num, label = data['get_label']
self.assertIs(index_page._cached, False)
fetched_label = index_page.get_label_from_page_number(num)
self.assertIs(index_page._cached, True)
self.assertEqual(label, fetched_label)
# Check if cache is refreshed.
index_page._labels_from_page_number[num] = 'wrong cached value'
self.assertEqual(index_page.get_label_from_page_number(num),
'wrong cached value')
index_page._cached = False
self.assertEqual(index_page.get_label_from_page_number(num), label)