当前位置: 首页>>代码示例>>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;未经允许,请勿转载。