Skip to content

Commit fce5356

Browse files
committed
refactor: Standardise Python open parenthesesis error
1 parent 1286aa8 commit fce5356

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

python/cucumber_tag_expressions/parser.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,10 @@ def ensure_expected_token_type(token_type, index):
275275
last_operation = operations.pop()
276276
if last_operation is Token.OPEN_PARENTHESIS:
277277
# -- CASE: TOO MANY OPEN-PARENTHESIS
278-
message = "Unclosed '(': Too many open-parens in: %s" % text
278+
message = (
279+
'Tag expression "%s" could not be parsed because of syntax error:'
280+
' Unmatched (.' % text
281+
)
279282
raise TagExpressionError(message)
280283
cls._push_expression(last_operation, expressions)
281284

python/tests/unit/test_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def test_parse__with_escape_repr(self, text, expected):
194194
# -- BAD CASES:
195195
@pytest.mark.parametrize("text, error_message", [
196196
("( a and b ))", "Missing '(': Too few open-parens"),
197-
("( ( a and b )", "Unclosed '(': Too many open-parens"),
197+
("( ( a and b )", "Unmatched (."),
198198
])
199199
def test_parse__fails_with_unbalanced_parens(self, text, error_message):
200200
self.assert_parse_with_error_contains_message(text, error_message)

0 commit comments

Comments
 (0)