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)
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)
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))
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))