当前位置: 首页>>代码示例>>Python>>正文


Python Application.iter_editors方法代码示例

本文整理汇总了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)
开发者ID:khairy,项目名称:editxt,代码行数:42,代码来源:test_application.py


注:本文中的editxt.application.Application.iter_editors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。