Skip to content

Commit c89148b

Browse files
committed
Merge remote-tracking branch 'origin/pr/2207' into development
2 parents b182397 + 111ba0e commit c89148b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/scripts/mbedtls_test.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,10 @@ def __escaped_split(inp_str, split_char):
7575
:param split_char: Split character
7676
:return: List of splits
7777
"""
78+
split_colon_fn = lambda x: re.sub(r'\\' + split_char, split_char, x)
7879
if len(split_char) > 1:
7980
raise ValueError('Expected split character. Found string!')
80-
out = re.sub(r'(\\.)|' + split_char,
81-
lambda m: m.group(1) or '\n', inp_str,
82-
len(inp_str)).split('\n')
81+
out = map(split_colon_fn, re.split(r'(?<!\\)' + split_char, inp_str))
8382
out = [x for x in out if x]
8483
return out
8584

@@ -112,8 +111,8 @@ def __parse(self, data_f):
112111
args = parts[1:]
113112
args_count = len(args)
114113
if args_count % 2 != 0:
115-
raise TestDataParserError("Number of test arguments should "
116-
"be even: %s" % line)
114+
err_str_fmt = "Number of test arguments({}) should be even: {}"
115+
raise TestDataParserError(err_str_fmt.format(args_count, line))
117116
grouped_args = [(args[i * 2], args[(i * 2) + 1])
118117
for i in range(len(args)/2)]
119118
self.tests.append((name, function_name, dependencies,

0 commit comments

Comments
 (0)