def test_toggle_tabs(self, askyesno): editor = DummyEditwin(None, None) # usetabs == False. indents = ft.Indents(editor) askyesno.return_value = True indents.toggle_tabs_event(None) self.assertEqual(editor.usetabs, True) self.assertEqual(editor.indentwidth, 8) indents.toggle_tabs_event(None) self.assertEqual(editor.usetabs, False) self.assertEqual(editor.indentwidth, 8)
def test_change_indentwidth(self, askinteger): editor = DummyEditwin(None, None) # indentwidth == 4. indents = ft.Indents(editor) askinteger.return_value = None indents.change_indentwidth_event(None) self.assertEqual(editor.indentwidth, 4) askinteger.return_value = 3 indents.change_indentwidth_event(None) self.assertEqual(editor.indentwidth, 3) askinteger.return_value = 5 editor.usetabs = True indents.change_indentwidth_event(None) self.assertEqual(editor.indentwidth, 3)