2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit c2875a32 authored by Eckhart Arnold's avatar Eckhart Arnold
Browse files

- bugfix: regular expression RE_VALUE in testing incompatible with pypy3's re-engine

parent 70b905aa
......@@ -78,8 +78,12 @@ UNIT_STAGES = {'match', 'fail', 'ast', 'cst', '__ast__', '__cst__'}
# return unit
RX_SECTION = re.compile('\s*\[(?P<stage>\w+):(?P<symbol>\w+)\]')
RE_VALUE = '(?:"""((?s:.*?))""")|' + "(?:'''((?s:.*?))''')|" + \
RE_VALUE = '(?:"""((?:.|\n)*?)""")|' + "(?:'''((?:.|\n)*?)''')|" + \
'(?:"(.*?)")|' + "(?:'(.*?)')|" + '(.*(?:\n(?:\s*\n)* .*)*)'
# the following does not work with pypy3, because pypy's re-engine does not
# support local flags, e.g. '(?s: )'
# RE_VALUE = '(?:"""((?s:.*?))""")|' + "(?:'''((?s:.*?))''')|" + \
# '(?:"(.*?)")|' + "(?:'(.*?)')|" + '(.*(?:\n(?:\s*\n)* .*)*)'
RX_ENTRY = re.compile('\s*(\w+)\s*:\s*(?:{value})\s*'.format(value=RE_VALUE))
RX_COMMENT = re.compile('\s*#.*\n')
......
......@@ -25,11 +25,10 @@ import os
import pstats
import sys
import DHParser.log
sys.path.extend(['../../', '../', './'])
import DHParser.dsl
import DHParser.log
from DHParser.log import log_parsing_history
......
......@@ -21,11 +21,10 @@ limitations under the License.
import sys
import DHParser.log
sys.path.extend(['../../', '../', './'])
from DHParser import dsl
import DHParser.log
from DHParser import testing
# print(dir(dsl))
......
......@@ -100,7 +100,7 @@ class TestTestfiles:
def test_unit_from_config_file(self):
unit = unit_from_configfile('configfile_test_1.ini')
assert list(unit.keys()) == ['ParserA']
assert list(unit['ParserA'].keys()) == ['match', 'fail']
assert list(unit['ParserA'].keys()) == ['match', 'fail'], str(list(unit['ParserA'].keys()))
assert list(unit['ParserA']['match'].keys()) == ['M1', 'M2', 'M3', 'M4']
assert list(unit['ParserA']['fail'].keys()) == ['F1']
testcase = unit['ParserA']['match']['M4']
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment