本文整理汇总了Python中unit.ewslib_testcase.LIB._is_widget_cached方法的典型用法代码示例。如果您正苦于以下问题:Python LIB._is_widget_cached方法的具体用法?Python LIB._is_widget_cached怎么用?Python LIB._is_widget_cached使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unit.ewslib_testcase.LIB
的用法示例。
在下文中一共展示了LIB._is_widget_cached方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_verify_widget_caching_behavior
# 需要导入模块: from unit.ewslib_testcase import LIB [as 别名]
# 或者: from unit.ewslib_testcase.LIB import _is_widget_cached [as 别名]
def test_verify_widget_caching_behavior(self):
self.navigate(data.PD_URL)
widget_id = "fwk_menu_16"
widget_name = "Related Links"
#initially widget is uncached
self.assertIsNone(LIB._is_widget_cached(widget_name))
#call with cache_widget = False and widget is Not cached
t0 = time.clock()
LIB._get_widget_by_name(widget_name, False)
uncached_retrival_time = time.clock() - t0
self.assertIsNone(LIB._is_widget_cached(widget_name))
#default - call with cach_widget = True and widget is cached
widget = LIB._get_widget_by_name(widget_name)
t1 = time.clock()
cached_widget = LIB._get_widget_by_name(widget_name)
cached_retrival_time = time.clock() - t1
self.assertEqual(widget.text, cached_widget.text)
self.assertTrue(cached_retrival_time < uncached_retrival_time)
print "Uncached retrival time = %f Cached retrival time = %f" % (uncached_retrival_time, cached_retrival_time)
#and widget id should be set to name_widget
self.assertEqual("%s_widget" % (widget_name), widget.get_attribute('id'))
#and cache should be invalidated after reload
LIB.reload_page()
self.assertIsNone(LIB._is_widget_cached(widget_name))