Skip to content

Commit

Permalink
Add test for replace in selection (test issue spyder-ide#5494)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaverde committed Nov 8, 2017
1 parent bc644ba commit 373e052
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions spyder/widgets/tests/test_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,30 @@ def test_replace_plain_regex(editor_find_replace_bot):
qtbot.keyPress(finder.replace_text, Qt.Key_Return)
assert editor.toPlainText()[0:-1] == expected_new_text


def test_selection_escape_characters(editor_find_replace_bot):
editor_stack, editor, finder, qtbot = editor_find_replace_bot
expected_new_text = ('spam bacon\n'
'spam sausage\n'
'spam egg\n'
'\\n \\t some escape characters')
qtbot.keyClicks(editor, '\\n \\t escape characters')

finder.show()
finder.show_replace()
qtbot.keyClicks(finder.search_text, 'escape')
qtbot.keyClicks(finder.replace_text, 'some escape')

# Select last line
cursor = editor.textCursor()
cursor.select(QTextCursor.LineUnderCursor)
assert cursor.selection().toPlainText() == "\\n \\t escape characters"

#replace
finder.replace_find_selection()
assert editor.toPlainText() == expected_new_text


def test_advance_cell(editor_cells_bot):
editor_stack, editor, qtbot = editor_cells_bot

Expand Down

0 comments on commit 373e052

Please sign in to comment.