コード例 #1
0
ファイル: test_application.py プロジェクト: khairy/editxt
 def test(has_current):
     m = Mocker()
     ac = Application()
     ac.current_editor = m.method(ac.current_editor)
     if has_current:
         ed = m.mock(Editor)
         proj = (ac.current_editor() >> ed).new_project() >> m.mock(Project)
     else:
         ac.current_editor() >> None
         proj = None
     with m:
         result = ac.new_project()
         eq_(result, proj)
コード例 #2
0
ファイル: test_application.py プロジェクト: khairy/editxt
 def test(has_current):
     m = Mocker()
     ac = Application()
     ac.current_editor = m.method(ac.current_editor)
     if has_current:
         ed = m.mock(Editor)
         proj = (ac.current_editor() >> ed).new_project() >> m.mock(Project)
     else:
         ac.current_editor() >> None
         proj = None
     with m:
         result = ac.new_project()
         eq_(result, proj)
コード例 #3
0
ファイル: test_application.py プロジェクト: khairy/editxt
 def test(config):
     ac = Application()
     m = Mocker()
     ac.iter_editors = iwc = m.method(ac.iter_editors)
     iwc() >> iter(config)
     with m:
         result = ac.current_editor()
         eq_(result, (config[0] if config else None))
コード例 #4
0
ファイル: test_application.py プロジェクト: khairy/editxt
 def test(config):
     ac = Application()
     m = Mocker()
     ac.iter_editors = iwc = m.method(ac.iter_editors)
     iwc() >> iter(config)
     with m:
         result = ac.current_editor()
         eq_(result, (config[0] if config else None))