def test_comment(qtbot): editor_ref = create_editor("python") editor_ref.text = "# This is a comment\ndef foo():\n # pass\n pass" editor_ref.selectAll() helpers.comment_or_uncomment(editor_ref) assert editor_ref.text == ("# # This is a comment\n# def foo():\n# " "# pass\n# pass")
def editor_comment(self): """Mark the current line or selection as a comment.""" editor_widget = self.get_current_editor() if editor_widget is not None: helpers.comment_or_uncomment(editor_widget)
def editor_comment(self): """Mark the current line or selection as a comment.""" editorWidget = self.get_current_editor() if editorWidget and editorWidget.hasFocus(): helpers.comment_or_uncomment(editorWidget)
def test_simple_uncomment(qtbot): editor_ref = create_editor("python") editor_ref.text = "# this\nis\na\ntext" helpers.comment_or_uncomment(editor_ref) assert editor_ref.text == "this\nis\na\ntext"
def test_uncomment2(qtbot): editor_ref = create_editor("python") editor_ref.text = "print\n# print" editor_ref.selectAll() helpers.comment_or_uncomment(editor_ref) assert editor_ref.text == "# print\n# # print"
def test_uncomment_selected_lines(qtbot): editor_ref = create_editor("python") editor_ref.text = "# this\n# is\n# a\n# text" editor_ref.selectAll() helpers.comment_or_uncomment(editor_ref) assert editor_ref.text == "this\nis\na\ntext"