本文整理匯總了Python中workflow.workflow.Workflow類的典型用法代碼示例。如果您正苦於以下問題:Python Workflow類的具體用法?Python Workflow怎麽用?Python Workflow使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Workflow類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_last_version_explicit_version
def test_last_version_explicit_version(self):
"""Workflow: last_version explicit version"""
vstr = '1.9.6'
wf = Workflow()
self.assertTrue(wf.set_last_version(vstr))
self.assertEqual(wf.last_version_run, Version(vstr))
wf.reset()
示例2: test_first_run_with_version
def test_first_run_with_version(alfred4, infopl):
"""Workflow: first_run"""
vstr = '1.9.7'
with env(alfred_workflow_version=vstr):
wf = Workflow()
assert wf.first_run is True
wf.reset()
示例3: test_last_version_explicit_version
def test_last_version_explicit_version(alfred4, infopl):
"""Workflow: last_version explicit version"""
vstr = '1.9.6'
wf = Workflow()
assert wf.set_last_version(vstr) is True
assert wf.last_version_run == Version(vstr)
wf.reset()
示例4: test_first_run_with_version
def test_first_run_with_version(self):
"""Workflow: first_run"""
vstr = '1.9.7'
with VersionFile(vstr):
with InfoPlist():
wf = Workflow()
self.assertTrue(wf.first_run)
wf.reset()
示例5: test_last_version_auto_version
def test_last_version_auto_version(alfred4, infopl):
"""Workflow: last_version auto version"""
vstr = '1.9.7'
with env(alfred_workflow_version=vstr):
wf = Workflow()
assert wf.set_last_version() is True
assert wf.last_version_run == Version(vstr)
wf.reset()
示例6: test_first_run_no_version
def test_first_run_no_version(alfred4, infopl2):
"""Workflow: first_run fails on no version"""
with env(alfred_workflow_version=None):
wf = Workflow()
try:
with pytest.raises(ValueError):
wf.first_run
finally:
wf.reset()
示例7: test_last_version_auto_version
def test_last_version_auto_version(self):
"""Workflow: last_version auto version"""
vstr = '1.9.7'
with VersionFile(vstr):
with InfoPlist():
wf = Workflow()
self.assertTrue(wf.set_last_version())
self.assertEqual(wf.last_version_run, Version(vstr))
wf.reset()
示例8: test_additional_libs
def test_additional_libs(alfred4, infopl):
"""Additional libraries"""
wf = Workflow(libraries=LIBS)
for path in LIBS:
assert path in sys.path
assert sys.path[0:len(LIBS)] == LIBS
import youcanimportme
youcanimportme.noop()
wf.reset()
示例9: test_first_run_with_previous_run
def test_first_run_with_previous_run(alfred4, infopl):
"""Workflow: first_run with previous run"""
vstr = '1.9.7'
last_vstr = '1.9.6'
with env(alfred_workflow_version=vstr):
wf = Workflow()
wf.set_last_version(last_vstr)
assert wf.first_run is True
assert wf.last_version_run == Version(last_vstr)
wf.reset()
示例10: test_run_fails
def test_run_fails(infopl):
"""Run fails"""
wf = Workflow()
def cb(wf2):
assert wf2 is wf
raise ValueError('Have an error')
wf.help_url = 'http://www.deanishe.net/alfred-workflow/'
ret = wf.run(cb)
assert ret == 1
# read name from info.plist
with env(alfred_workflow_name=None):
wf = Workflow()
wf.name
ret = wf.run(cb)
assert ret == 1
# named after bundleid
wf = Workflow()
wf.bundleid
ret = wf.run(cb)
assert ret == 1
wf.reset()
示例11: test_first_run_with_previous_run
def test_first_run_with_previous_run(self):
"""Workflow: first_run with previous run"""
vstr = '1.9.7'
last_vstr = '1.9.6'
with VersionFile(vstr):
with InfoPlist():
wf = Workflow()
wf.set_last_version(last_vstr)
self.assertTrue(wf.first_run)
self.assertEqual(wf.last_version_run, Version(last_vstr))
wf.reset()
示例12: test_delete_cache
def test_delete_cache(self):
"""Magic: delete cache"""
c = WorkflowMock(['script', 'workflow:delcache'])
wf = Workflow()
testpath = wf.cachefile('file.test')
with open(testpath, 'wb') as file_obj:
file_obj.write('test!')
with c:
self.assertTrue(os.path.exists(testpath))
# Process magic arguments
wf.args
self.assertFalse(os.path.exists(testpath))
示例13: test_delete_settings
def test_delete_settings(self):
"""Magic: delete settings"""
c = WorkflowMock(['script', 'workflow:delsettings'])
wf = Workflow()
wf.settings['key'] = 'value'
filepath = wf.datafile('settings.json')
with c:
self.assertTrue(os.path.exists(filepath))
wf2 = Workflow()
self.assertEquals(wf2.settings.get('key'), 'value')
# Process magic arguments
wf.args
self.assertFalse(os.path.exists(filepath))
wf3 = Workflow()
self.assertFalse('key' in wf3.settings)
示例14: setUp
def setUp(self):
self.libs = [os.path.join(os.path.dirname(__file__), 'lib')]
self.wf = Workflow(libraries=self.libs)
self.account = 'this-is-my-test-account'
self.password = 'this-is-my-safe-password'
self.password2 = 'this-is-my-other-safe-password'
self.search_items = [
('Test Item One', MATCH_STARTSWITH),
('test item two', MATCH_STARTSWITH),
('TwoExtraSpecialTests', MATCH_CAPITALS),
('this-is-a-test', MATCH_ATOM),
('the extra special trials', MATCH_INITIALS_STARTSWITH),
('not the extra special trials', MATCH_INITIALS_CONTAIN),
('intestinal fortitude', MATCH_SUBSTRING),
('the splits', MATCH_ALLCHARS),
('nomatch', 0),
]
self.search_items_diacritics = [
# search key, query
('Änderungen vorbehalten', 'av'),
('Änderungen', 'anderungen'),
('überwiegend bewolkt', 'ub'),
('überwiegend', 'uberwiegend'),
('Öffnungszeiten an Feiertagen', 'offnungszeiten'),
('Öffnungszeiten an Feiertagen', 'oaf'),
('Fußpilz', 'fuss'),
('salé', 'sale')
]
示例15: setUp
def setUp(self):
self.libs = [os.path.join(os.path.dirname(__file__), "lib")]
self.wf = Workflow(libraries=self.libs)
self.account = "this-is-my-test-account"
self.password = "this-is-my-safe-password"
self.password2 = "this-is-my-other-safe-password"
self.search_items = [
("Test Item One", MATCH_STARTSWITH),
("test item two", MATCH_STARTSWITH),
("TwoExtraSpecialTests", MATCH_CAPITALS),
("this-is-a-test", MATCH_ATOM),
("the extra special trials", MATCH_INITIALS_STARTSWITH),
("not the extra special trials", MATCH_INITIALS_CONTAIN),
("intestinal fortitude", MATCH_SUBSTRING),
("the splits", MATCH_ALLCHARS),
("nomatch", 0),
]
self.search_items_diacritics = [
# search key, query
("Änderungen vorbehalten", "av"),
("Änderungen", "anderungen"),
("überwiegend bewolkt", "ub"),
("überwiegend", "uberwiegend"),
("Öffnungszeiten an Feiertagen", "offnungszeiten"),
("Öffnungszeiten an Feiertagen", "oaf"),
("Fußpilz", "fuss"),
("salé", "sale"),
]