def test_WrapLinesController_default_options(): with replace_history() as history: ctl = WrapLinesController(None) eq_(ctl.options._target, mod.Options( wrap_column=const.DEFAULT_RIGHT_MARGIN, indent=True, ))
def test(command, options): m = Mocker() nspb = m.replace(ak, 'NSPasteboard') pboard = nspb.pasteboardWithName_(ak.NSFindPboard) pboard.availableTypeFromArray_([ak.NSStringPboardType]) >> None with m, replace_history() as history: fc = FindController() sender = Config(selectedItem=lambda:Config(title=lambda:command)) fc.recentFindSelected_(sender) eq_(fc.options._target, options)
def test(command, options): m = Mocker() nspb = m.replace(ak, 'NSPasteboard') pboard = nspb.pasteboardWithName_(ak.NSFindPboard) pboard.availableTypeFromArray_([ak.NSStringPboardType]) >> None with m, replace_history() as history: fc = FindController() sender = Config(selectedItem=lambda: Config(title=lambda: command)) fc.recentFindSelected_(sender) eq_(fc.options._target, options)
def test_SortLinesController_sort_(): m = Mocker() sort = m.replace(mod, 'sortlines') tv = m.mock(TextView) with replace_history() as history: slc = SortLinesController(tv) sort(tv, slc.options) m.method(slc.save_options)() m.method(slc.cancel_)(None) with m: slc.sort_(None)
def test(c): m = Mocker() nspb = m.replace(ak, 'NSPasteboard') pboard = nspb.pasteboardWithName_(ak.NSFindPboard) pboard.availableTypeFromArray_([ak.NSStringPboardType]) >> (c.ftext is not None) if c.ftext is not None: pboard.stringForType_(ak.NSStringPboardType) >> c.ftext with replace_history() as history: if c.hist is not None: history.append(c.hist) with m: fc = FindController() # calls load_options() eq_(fc.options._target, FindOptions(**c.opts)) eq_(fc.options.recent_finds, [] if c.hist is None else [c.hist])
def test(c): m = Mocker() nspb = m.replace(ak, 'NSPasteboard') pboard = nspb.pasteboardWithName_(ak.NSFindPboard) pboard.availableTypeFromArray_([ak.NSStringPboardType ]) >> (c.ftext is not None) if c.ftext is not None: pboard.stringForType_(ak.NSStringPboardType) >> c.ftext with replace_history() as history: if c.hist is not None: history.append(c.hist) with m: fc = FindController() # calls load_options() eq_(fc.options._target, FindOptions(**c.opts)) eq_(fc.options.recent_finds, [] if c.hist is None else [c.hist])
def test(c): m = Mocker() with replace_history() as history: fc = FindController() # calls load_options() fc.options.find_text = "" # clear value from real pasteboard fc.options.ignore_case = False nspb = m.replace(ak, 'NSPasteboard') if "find_text" in c.opts: pboard = nspb.pasteboardWithName_(ak.NSFindPboard) pboard.declareTypes_owner_([ak.NSStringPboardType], None) pboard.setString_forType_(c.opts["find_text"], ak.NSStringPboardType) with m: for k, v in c.opts.items(): setattr(fc.options, k, v) print(fc.options._target) eq_(fc.save_options(), c.res, fc.options._target) eq_(list(history), [] if c.hist is None else [c.hist])
def test(hist, opts): with replace_history() as history: history.append(hist) ctl = SortLinesController(None) eq_(ctl.options._target, SortOptions(**opts))
def test_SortLinesController_default_options(): with replace_history() as history: ctl = SortLinesController(None) for name, value in SortOptions.DEFAULTS.items(): eq_(getattr(ctl.options, name), value, name)