Skip to content

Commit

Permalink
Add simple html cleaning function for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jieter committed Dec 10, 2016
1 parent 6fcaaf3 commit 2ae0ae6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
import warnings
from contextlib import contextmanager

Expand Down Expand Up @@ -78,3 +79,8 @@ def build_request(uri='/'):
'wsgi.multithread': False,
'wsgi.run_once': False,
})


def clean_output(s):
'''Remove double newlines with whitespace in between and reduce the level of indentation'''
return re.sub('\n( *\n)+', '\n', s).replace(' ', ' ')

0 comments on commit 2ae0ae6

Please sign in to comment.