本文整理匯總了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())