X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Futils%2Fpython%2Ftap%2Fparser.py;h=bb89fbf2f3c4f109bb529008b82c32df6b356d36;hb=768f9bcbf4b5acd09dda85ab32c0ea30d8826136;hp=7b2f096e6f649810389157be7fb6946c23dea4b9;hpb=b85894a3df84e5a19736e0fa7ea848e56f696c63;p=babeltrace.git diff --git a/tests/utils/python/tap/parser.py b/tests/utils/python/tap/parser.py index 7b2f096e..bb89fbf2 100644 --- a/tests/utils/python/tap/parser.py +++ b/tests/utils/python/tap/parser.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-2-Clause +# # Copyright (c) 2016, Matt Layman from io import StringIO @@ -24,20 +26,26 @@ class Parser(object): """ ok = re.compile(r'^ok' + result_base, re.VERBOSE) not_ok = re.compile(r'^not\ ok' + result_base, re.VERBOSE) - plan = re.compile(r""" + plan = re.compile( + r""" ^1..(?P\d+) # Match the plan details. [^#]* # Consume any non-hash character to confirm only # directives appear with the plan details. \#? # Optional directive marker. \s* # Optional whitespace. (?P.*) # Optional directive text. - """, re.VERBOSE) + """, + re.VERBOSE, + ) diagnostic = re.compile(r'^#') - bail = re.compile(r""" + bail = re.compile( + r""" ^Bail\ out! \s* # Optional whitespace. (?P.*) # Optional reason. - """, re.VERBOSE) + """, + re.VERBOSE, + ) version = re.compile(r'^TAP version (?P\d+)$') TAP_MINIMUM_DECLARED_VERSION = 13 @@ -117,12 +125,16 @@ class Parser(object): def _parse_result(self, ok, match): """Parse a matching result line into a result instance.""" return Result( - ok, match.group('number'), match.group('description').strip(), - Directive(match.group('directive'))) + ok, + match.group('number'), + match.group('description').strip(), + Directive(match.group('directive')), + ) def _parse_version(self, match): version = int(match.group('version')) if version < self.TAP_MINIMUM_DECLARED_VERSION: - raise ValueError(_('It is an error to explicitly specify ' - 'any version lower than 13.')) + raise ValueError( + _('It is an error to explicitly specify ' 'any version lower than 13.') + ) return Version(version)