本文整理汇总了Python中editxt.application.Application.setup_profile方法的典型用法代码示例。如果您正苦于以下问题:Python Application.setup_profile方法的具体用法?Python Application.setup_profile怎么用?Python Application.setup_profile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类editxt.application.Application
的用法示例。
在下文中一共展示了Application.setup_profile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_setup_profile_at_file
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import setup_profile [as 别名]
def test_setup_profile_at_file():
with tempdir() as tmp:
path = os.path.join(tmp, 'profile')
with open(path, 'w') as fh: pass
app = Application(path)
eq_(app.setup_profile(), False)
assert os.path.isfile(path), path
示例2: test
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import setup_profile [as 别名]
def test(with_id=True, fail=False):
with tempdir() as tmp:
state_path = os.path.join(tmp, const.STATE_DIR)
window = TestConfig(state=[42], id=9)
args = (window.id,) if with_id else ()
app = Application(tmp)
app.setup_profile(windows=True)
state_name = app.save_window_state(window, state_path, *args)
if fail:
window = window(state="should not be written")
def dump_fail(state, fh=None):
if fh is not None:
fh.write("should not be seen")
raise Exception("dump fail!")
with replattr(mod, "dump_yaml", dump_fail, sigcheck=False):
state_name = app.save_window_state(window, state_path, *args)
assert os.path.isdir(state_path), state_path
with open(os.path.join(state_path, state_name)) as f:
eq_(load_yaml(f), [42])
示例3: test_setup_profile_parent_exists
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import setup_profile [as 别名]
def test_setup_profile_parent_exists():
with tempdir() as tmp:
path = os.path.join(tmp, 'profile')
app = Application(path)
eq_(app.setup_profile(), True)
assert os.path.exists(path), path
示例4: test_setup_profile_parent_missing
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import setup_profile [as 别名]
def test_setup_profile_parent_missing():
with tempdir() as tmp:
path = os.path.join(tmp, 'missing', 'profile')
app = Application(path)
eq_(app.setup_profile(), False)
assert not os.path.exists(path), path
示例5: test_setup_profile_exists
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import setup_profile [as 别名]
def test_setup_profile_exists():
with tempdir() as tmp:
app = Application(tmp)
eq_(app.setup_profile(), True)