本文整理匯總了Python中olympia.files.helpers.FileViewer.is_search_engine方法的典型用法代碼示例。如果您正苦於以下問題:Python FileViewer.is_search_engine方法的具體用法?Python FileViewer.is_search_engine怎麽用?Python FileViewer.is_search_engine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類olympia.files.helpers.FileViewer
的用法示例。
在下文中一共展示了FileViewer.is_search_engine方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TestSearchEngineHelper
# 需要導入模塊: from olympia.files.helpers import FileViewer [as 別名]
# 或者: from olympia.files.helpers.FileViewer import is_search_engine [as 別名]
class TestSearchEngineHelper(TestCase):
fixtures = ['base/addon_4594_a9']
def setUp(self):
super(TestSearchEngineHelper, self).setUp()
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()
super(TestSearchEngineHelper, self).tearDown()
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()
assert 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'))
assert self.viewer.get_default(None) is None