diff --git a/python_files/normalizeSelection.py b/python_files/normalizeSelection.py index 981251289e57..7ea283cc09a6 100644 --- a/python_files/normalizeSelection.py +++ b/python_files/normalizeSelection.py @@ -26,6 +26,10 @@ def _get_statements(selection): This will remove empty newlines around and within the selection, dedent it, and split it using the result of `ast.parse()`. """ + if '"""' in selection or "'''" in selection: + yield selection + return + # Remove blank lines within the selection to prevent the REPL from thinking the block is finished. lines = (line for line in split_lines(selection) if line.strip() != "") diff --git a/src/test/python_files/terminalExec/sample2_normalized_selection.py b/src/test/python_files/terminalExec/sample2_normalized_selection.py index a333d4e0daae..be7b280479c0 100644 --- a/src/test/python_files/terminalExec/sample2_normalized_selection.py +++ b/src/test/python_files/terminalExec/sample2_normalized_selection.py @@ -1,7 +1,15 @@ def add(x, y): - """Adds x to y""" + """ + + Adds x + to + y + + + """ # Some comment return x + y v = add(1, 7) print(v) + diff --git a/src/test/python_files/terminalExec/sample2_raw.py b/src/test/python_files/terminalExec/sample2_raw.py index 6ab7e67637f4..230abfda89cb 100644 --- a/src/test/python_files/terminalExec/sample2_raw.py +++ b/src/test/python_files/terminalExec/sample2_raw.py @@ -1,7 +1,13 @@ def add(x, y): - """Adds x to y""" + """ + + Adds x + to + y + + + """ # Some comment - return x + y v = add(1, 7)