本文整理汇总了Python中editxt.application.Application.iter_editors方法的典型用法代码示例。如果您正苦于以下问题:Python Application.iter_editors方法的具体用法?Python Application.iter_editors怎么用?Python Application.iter_editors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类editxt.application.Application
的用法示例。
在下文中一共展示了Application.iter_editors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import iter_editors [as 别名]
def test(config):
"""Test argument structure:
[ # collection of window controllers
[ # window controller / collection of projects
["doc1", "doc2", "doc3", ...], # project / collection of documents
...
]
...
]
"""
result = None
ac = Application()
m = Mocker()
dv = m.mock(TextDocumentView) # this is the view we're looking for
document = m.mock(TextDocument)
(dv.document << document).count(0, None)
ac.iter_editors = m.method(ac.iter_editors)
eds = ac.iter_editors() >> []
for ed_projects in config:
ed = m.mock(Editor)
eds.append(ed)
projects = []
ed.projects >> projects
found = False
for project_documents in ed_projects:
project = m.mock(Project)
projects.append(project)
documents = []
if not found:
project.documents() >> documents
for doc_name in project_documents:
if doc_name == DOC:
documents.append(dv)
result = ed
found = True
else:
documents.append(m.mock(TextDocumentView))
with m:
ed = ac.find_editor_with_document_view(dv)
eq_(ed, result)