Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2ae0ae6

Browse files
committed
Add simple html cleaning function for testing
1 parent 6fcaaf3 commit 2ae0ae6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import re
12
import warnings
23
from contextlib import contextmanager
34

@@ -78,3 +79,8 @@ def build_request(uri='/'):
7879
'wsgi.multithread': False,
7980
'wsgi.run_once': False,
8081
})
82+
83+
84+
def clean_output(s):
85+
'''Remove double newlines with whitespace in between and reduce the level of indentation'''
86+
return re.sub('\n( *\n)+', '\n', s).replace(' ', ' ')

0 commit comments

Comments
 (0)