Пример #1
0
 def test(has_current):
     m = Mocker()
     ac = Application()
     ac.current_window = m.method(ac.current_window)
     if has_current:
         ed = m.mock(Window)
         proj = (ac.current_window() >> ed).new_project() >> m.mock(Project)
     else:
         ac.current_window() >> None
         proj = None
     with m:
         result = ac.new_project()
         eq_(result, proj)
Пример #2
0
 def test(config):
     ac = Application()
     m = Mocker()
     ac.iter_windows = iwc = m.method(ac.iter_windows)
     iwc() >> iter(config)
     with m:
         result = ac.current_window()
         eq_(result, (config[0] if config else None))