Use textwrap.dedent to parse multiline clipboard text

This commit is contained in:
Tarcisio Fedrizzi 2016-01-12 11:24:31 +01:00
parent f08704e789
commit 524341fd7a

View File

@ -25,6 +25,7 @@ import json
import os.path import os.path
import logging import logging
import collections import collections
import textwrap
import pytest import pytest
import yaml import yaml
@ -209,8 +210,7 @@ def fill_clipboard(qtbot, qapp, httpbin, what, content):
r'(?P<what>primary selection|clipboard):\n' r'(?P<what>primary selection|clipboard):\n'
r'(?P<content>.+)$', flags=re.DOTALL)) r'(?P<content>.+)$', flags=re.DOTALL))
def fill_clipboard_multiline(qtbot, qapp, httpbin, what, content): def fill_clipboard_multiline(qtbot, qapp, httpbin, what, content):
content = '\n'.join(l.strip() for l in content.strip().split('\n')) fill_clipboard(qtbot, qapp, httpbin, what, textwrap.dedent(content))
fill_clipboard(qtbot, qapp, httpbin, what, content)
## Then ## Then