From 373e0520a6ffd0b38de527c71a270d3218b3dee0 Mon Sep 17 00:00:00 2001 From: Rafael Laverde Date: Wed, 8 Nov 2017 08:57:08 -0500 Subject: [PATCH] Add test for replace in selection (test issue #5494) --- spyder/widgets/tests/test_editor.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/spyder/widgets/tests/test_editor.py b/spyder/widgets/tests/test_editor.py index 60ebdfcf268..ff12b707573 100644 --- a/spyder/widgets/tests/test_editor.py +++ b/spyder/widgets/tests/test_editor.py @@ -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