本文整理汇总了Python中canvas.cache_patterns.CachedCall.force方法的典型用法代码示例。如果您正苦于以下问题:Python CachedCall.force方法的具体用法?Python CachedCall.force怎么用?Python CachedCall.force使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类canvas.cache_patterns.CachedCall
的用法示例。
在下文中一共展示了CachedCall.force方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_force_updates_cached_value
# 需要导入模块: from canvas.cache_patterns import CachedCall [as 别名]
# 或者: from canvas.cache_patterns.CachedCall import force [as 别名]
def test_force_updates_cached_value(self):
fun = CB(retvalue=1)
cc = CachedCall('key', fun)
cc()
fun.retvalue = 2
cc.force()
self.assertEqual(2, cc())
示例2: test_force_returns_new_value
# 需要导入模块: from canvas.cache_patterns import CachedCall [as 别名]
# 或者: from canvas.cache_patterns.CachedCall import force [as 别名]
def test_force_returns_new_value(self):
fun = CB(retvalue=1)
cc = CachedCall('key', fun)
cc()
fun.retvalue = 2
self.assertEqual(2, cc.force())
示例3: test_skip_decorator
# 需要导入模块: from canvas.cache_patterns import CachedCall [as 别名]
# 或者: from canvas.cache_patterns.CachedCall import force [as 别名]
def test_skip_decorator(self):
def decorator(self):
raise Exception
fun = CB()
cc = CachedCall('key', fun, decorator=decorator)
self.assertEquals(fun.retvalue, cc(skip_decorator=True))
self.assertEquals(fun.retvalue, cc.force(skip_decorator=True))
示例4: test_uncached_call_returns_jsonlike_result
# 需要导入模块: from canvas.cache_patterns import CachedCall [as 别名]
# 或者: from canvas.cache_patterns.CachedCall import force [as 别名]
def test_uncached_call_returns_jsonlike_result(self):
fun = CB(retvalue={1: 'bar'})
cc = CachedCall('key', fun)
self.assertEquals({'1': 'bar'}, cc())
self.assertEquals({'1': 'bar'}, cc.force())