# HG changeset patch # User Teemu Piippo # Date 1561358741 -10800 # Node ID 6a0b43a5dec047426bddf3de31bdd2230fbeb267 # Parent 90105119ff9073aac87c162de6f13755dae9c986 moved the bad whitespace test to a new file diff -r 90105119ff90 -r 6a0b43a5dec0 tests/bad-whitespace.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/bad-whitespace.py Mon Jun 24 09:45:41 2019 +0300 @@ -0,0 +1,29 @@ +from testsuite import problem_type, report_problem +import linetypes + +@problem_type('bad-whitespace', + severity = 'hold', + message = lambda whitespaces: str.format( + 'non-standard whitespace in description: {whitespaces}', + whitespaces = whitespaces, + ) +) +def bad_whitespace_test(model): + if model.header.valid: + import re + description = model.header.description + # checking against string.whitespace is not adequate enough + # because it only contains ASCII characters. So checking using a + # regular expression is necessary. + bad_whitespaces = set(re.findall('\s', description)) - {' '} + if bad_whitespaces: + yield report_problem( + 'bad-whitespace', + bad_object = model.body[0], + whitespaces = ', '.join( + repr(whitespace) + for whitespace in sorted(bad_whitespaces) + ), + ) + +manifest = {'tests': [bad_whitespace_test]} diff -r 90105119ff90 -r 6a0b43a5dec0 tests/misc.py --- a/tests/misc.py Mon Jun 24 01:13:02 2019 +0300 +++ b/tests/misc.py Mon Jun 24 09:45:41 2019 +0300 @@ -229,31 +229,6 @@ command_text = element.text, ) -@problem_type('bad-whitespace', - severity = 'hold', - message = lambda whitespaces: str.format( - 'non-standard whitespace in description: {whitespaces}', - whitespaces = whitespaces, - ) -) -def bad_whitespace_test(model): - if model.header.valid: - import re - description = model.header.description - # checking against string.whitespace is not adequate enough - # because it only contains ASCII characters. So checking using a - # regular expression is necessary. - bad_whitespaces = set(re.findall('\s', description)) - {' '} - if bad_whitespaces: - yield report_problem( - 'bad-whitespace', - bad_object = model.body[0], - whitespaces = ', '.join( - repr(whitespace) - for whitespace in sorted(bad_whitespaces) - ), - ) - manifest = { 'tests': [ colours_test, @@ -268,6 +243,5 @@ moved_to_with_extension_test, bfc_invertnext_not_on_subfile_test, metacommands_test, - bad_whitespace_test, ], }