本文整理汇总了Python中files.helpers.FileViewer.is_search_engine方法的典型用法代码示例。如果您正苦于以下问题:Python FileViewer.is_search_engine方法的具体用法?Python FileViewer.is_search_engine怎么用?Python FileViewer.is_search_engine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类files.helpers.FileViewer
的用法示例。
在下文中一共展示了FileViewer.is_search_engine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestSearchEngineHelper
# 需要导入模块: from files.helpers import FileViewer [as 别名]
# 或者: from files.helpers.FileViewer import is_search_engine [as 别名]
class TestSearchEngineHelper(amo.tests.TestCase):
fixtures = ['base/addon_4594_a9']
def setUp(self):
self.left = File.objects.get(pk=25753)
self.viewer = FileViewer(self.left)
if not os.path.exists(os.path.dirname(self.viewer.src)):
os.makedirs(os.path.dirname(self.viewer.src))
with storage.open(self.viewer.src, 'w') as f:
f.write('some data\n')
def tearDown(self):
self.viewer.cleanup()
def test_is_search_engine(self):
assert self.viewer.is_search_engine()
def test_extract_search_engine(self):
self.viewer.extract()
assert os.path.exists(self.viewer.dest)
def test_default(self):
self.viewer.extract()
eq_(self.viewer.get_default(None), 'a9.xml')
def test_default_no_files(self):
self.viewer.extract()
os.remove(os.path.join(self.viewer.dest, 'a9.xml'))
eq_(self.viewer.get_default(None), None)
示例2: TestSearchEngineHelper
# 需要导入模块: from files.helpers import FileViewer [as 别名]
# 或者: from files.helpers.FileViewer import is_search_engine [as 别名]
class TestSearchEngineHelper(amo.tests.TestCase):
fixtures = ["base/addon_4594_a9"]
def setUp(self):
self.left = File.objects.get(pk=25753)
self.viewer = FileViewer(self.left)
if not os.path.exists(os.path.dirname(self.viewer.src)):
os.makedirs(os.path.dirname(self.viewer.src))
open(self.viewer.src, "w")
def tearDown(self):
self.viewer.cleanup()
def test_is_search_engine(self):
assert self.viewer.is_search_engine()
def test_extract_search_engine(self):
self.viewer.extract()
assert os.path.exists(self.viewer.dest)
def test_default(self):
self.viewer.extract()
eq_(self.viewer.get_default(None), "a9.xml")
def test_default_no_files(self):
self.viewer.extract()
os.remove(os.path.join(self.viewer.dest, "a9.xml"))
eq_(self.viewer.get_default(None), None)