當前位置: 首頁>>代碼示例>>Python>>正文


Python CacheManager.keys方法代碼示例

本文整理匯總了Python中ulif.openoffice.cachemanager.CacheManager.keys方法的典型用法代碼示例。如果您正苦於以下問題:Python CacheManager.keys方法的具體用法?Python CacheManager.keys怎麽用?Python CacheManager.keys使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ulif.openoffice.cachemanager.CacheManager的用法示例。


在下文中一共展示了CacheManager.keys方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_keys

# 需要導入模塊: from ulif.openoffice.cachemanager import CacheManager [as 別名]
# 或者: from ulif.openoffice.cachemanager.CacheManager import keys [as 別名]
 def test_keys(self, cache_env):
     # we can get all cache keys
     cm = CacheManager(str(cache_env / "cache"))
     src1 = str(cache_env / "src1.txt")
     src2 = str(cache_env / "src2.txt")
     result1 = str(cache_env / "result1.txt")
     result2 = str(cache_env / "result2.txt")
     key1 = cm.register_doc(src1, result1, 'foo')
     assert list(cm.keys()) == ['737b337e605199de28b3b64c674f9422_1_1']
     assert key1 == '737b337e605199de28b3b64c674f9422_1_1'
     key2 = cm.register_doc(src1, result2, 'bar')
     assert sorted(list(cm.keys())) == [
         '737b337e605199de28b3b64c674f9422_1_1',
         '737b337e605199de28b3b64c674f9422_1_2',
     ]
     assert key2 == '737b337e605199de28b3b64c674f9422_1_2'
     key3 = cm.register_doc(src2, result1, 'baz')
     assert sorted(list(cm.keys())) == [
         '737b337e605199de28b3b64c674f9422_1_1',
         '737b337e605199de28b3b64c674f9422_1_2',
         'd5aa51d7fb180729089d2de904f7dffe_1_1',
     ]
     assert key3 == 'd5aa51d7fb180729089d2de904f7dffe_1_1'
開發者ID:sbywater,項目名稱:ulif.openoffice,代碼行數:25,代碼來源:test_cachemanager.py

示例2: test_keys_custom_level

# 需要導入模塊: from ulif.openoffice.cachemanager import CacheManager [as 別名]
# 或者: from ulif.openoffice.cachemanager.CacheManager import keys [as 別名]
 def test_keys_custom_level(self):
     # we can get all cache keys also with custom level set
     cm = CacheManager(self.workdir, level=3)
     key1 = cm.register_doc(self.src_path1, self.result_path1, 'foo')
     self.assertEqual(
         list(cm.keys()),
         ['737b337e605199de28b3b64c674f9422_1_1']
         )
     key2 = cm.register_doc(self.src_path1, self.result_path2, 'bar')
     self.assertEqual(
         sorted(list(cm.keys())),
         ['737b337e605199de28b3b64c674f9422_1_1',
          '737b337e605199de28b3b64c674f9422_1_2',
          ]
         )
     key3 = cm.register_doc(self.src_path2, self.result_path1, 'baz')
     self.assertEqual(
         sorted(list(cm.keys())),
         ['737b337e605199de28b3b64c674f9422_1_1',
          '737b337e605199de28b3b64c674f9422_1_2',
          'd5aa51d7fb180729089d2de904f7dffe_1_1',
          ]
         )
     return
開發者ID:sennoy,項目名稱:ulif.openoffice,代碼行數:26,代碼來源:test_cachemanager.py

示例3: test_keys_custom_level

# 需要導入模塊: from ulif.openoffice.cachemanager import CacheManager [as 別名]
# 或者: from ulif.openoffice.cachemanager.CacheManager import keys [as 別名]
 def test_keys_custom_level(self, cache_env):
     # we can get all cache keys, even if a custom cache level is set
     # (and keys are stored in different location).
     cm = CacheManager(str(cache_env / "cache"), level=3)
     src1 = str(cache_env / "src1.txt")
     src2 = str(cache_env / "src2.txt")
     result1 = str(cache_env / "result1.txt")
     result2 = str(cache_env / "result2.txt")
     key1 = cm.register_doc(src1, result1, 'foo')
     assert list(cm.keys()) == ['737b337e605199de28b3b64c674f9422_1_1']
     assert key1 == '737b337e605199de28b3b64c674f9422_1_1'
     key2 = cm.register_doc(src1, result2, 'bar')
     assert sorted(list(cm.keys())) == [
         '737b337e605199de28b3b64c674f9422_1_1',
         '737b337e605199de28b3b64c674f9422_1_2',
     ]
     assert key2 == '737b337e605199de28b3b64c674f9422_1_2'
     key3 = cm.register_doc(src2, result1, 'baz')
     assert sorted(list(cm.keys())) == [
         '737b337e605199de28b3b64c674f9422_1_1',
         '737b337e605199de28b3b64c674f9422_1_2',
         'd5aa51d7fb180729089d2de904f7dffe_1_1',
     ]
     assert key3 == 'd5aa51d7fb180729089d2de904f7dffe_1_1'
開發者ID:sbywater,項目名稱:ulif.openoffice,代碼行數:26,代碼來源:test_cachemanager.py


注:本文中的ulif.openoffice.cachemanager.CacheManager.keys方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。