Пример #1
0
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")
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
 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)
Пример #5
0
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"
Пример #6
0
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"
Пример #7
0
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"