本文整理汇总了Python中editxt.application.Application.init_syntax_definitions方法的典型用法代码示例。如果您正苦于以下问题:Python Application.init_syntax_definitions方法的具体用法?Python Application.init_syntax_definitions怎么用?Python Application.init_syntax_definitions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类editxt.application.Application
的用法示例。
在下文中一共展示了Application.init_syntax_definitions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_init_syntax_definitions
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import init_syntax_definitions [as 别名]
def test_init_syntax_definitions():
import editxt.syntax as syntax
m = Mocker()
app = Application(profile='/editxtdev')
rsrc_path = m.method(app.resource_path)() >> "/tmp/resources"
SyntaxFactory = m.replace(syntax, 'SyntaxFactory', spec=False)
sf = SyntaxFactory() >> m.mock(syntax.SyntaxFactory)
app_log = m.replace("editxt.application.log")
for path, info in [(rsrc_path, False), ('/editxtdev', True)]:
sf.load_definitions(join(path, const.SYNTAX_DEFS_DIR), info)
sf.index_definitions()
with m:
app.init_syntax_definitions()
示例2: test_init_syntax_definitions
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import init_syntax_definitions [as 别名]
def test_init_syntax_definitions():
from editxt.syntax import SyntaxFactory
m = Mocker()
app = Application()
sf_class = m.replace(SyntaxFactory, spec=False, passthrough=False)
app_log = m.replace("editxt.application.log", passthrough=False)
nsb = m.replace(NSBundle)
app_support_path = m.method(Application.app_support_path)
sf = sf_class() >> m.mock(SyntaxFactory)
rsrc_path = nsb.mainBundle().resourcePath() >> "/resources/syntax"
asup_path = app_support_path() >> "/app_support/syntax"
for path in [rsrc_path, asup_path]:
sf.load_definitions(os.path.join(path, const.SYNTAX_DEFS_DIR))
sf.index_definitions()
with m:
app.init_syntax_definitions()