Skip to content

Commit

Permalink
Keyword should be without trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
youtux committed Mar 11, 2022
1 parent 99b61fd commit dad75f7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pytest_bdd/new_parser.py
Expand Up @@ -100,7 +100,7 @@ def steps(self, step_groups: list[tuple[str, list[Tree]]]) -> list[Step]:
type=bdd_type,
line_number=type_token.line,
indent=type_token.column,
keyword=str(type_token),
keyword=str(type_token.strip()),
)
for bdd_type, [type_token, value_token] in steps_data
]
Expand Down
14 changes: 7 additions & 7 deletions tests/feature/test_cucumber_json.py
Expand Up @@ -125,14 +125,14 @@ def test_passing_outline():
"name": "Passing",
"steps": [
{
"keyword": "Given ",
"keyword": "Given",
"line": 6,
"match": {"location": ""},
"name": "a passing step",
"result": {"status": "passed", "duration": OfType(int)},
},
{
"keyword": "And ",
"keyword": "And",
"line": 7,
"match": {"location": ""},
"name": "some other passing step",
Expand All @@ -150,14 +150,14 @@ def test_passing_outline():
"name": "Failing",
"steps": [
{
"keyword": "Given ",
"keyword": "Given",
"line": 11,
"match": {"location": ""},
"name": "a passing step",
"result": {"status": "passed", "duration": OfType(int)},
},
{
"keyword": "And ",
"keyword": "And",
"line": 12,
"match": {"location": ""},
"name": "a failing step",
Expand All @@ -176,7 +176,7 @@ def test_passing_outline():
"line": 16,
"match": {"location": ""},
"result": {"status": "passed", "duration": OfType(int)},
"keyword": "Given ",
"keyword": "Given",
"name": "type str and value hello",
}
],
Expand All @@ -194,7 +194,7 @@ def test_passing_outline():
"line": 16,
"match": {"location": ""},
"result": {"status": "passed", "duration": OfType(int)},
"keyword": "Given ",
"keyword": "Given",
"name": "type int and value 42",
}
],
Expand All @@ -212,7 +212,7 @@ def test_passing_outline():
"line": 16,
"match": {"location": ""},
"result": {"status": "passed", "duration": OfType(int)},
"keyword": "Given ",
"keyword": "Given",
"name": "type float and value 1.0",
}
],
Expand Down
24 changes: 12 additions & 12 deletions tests/test_new_parser.py
Expand Up @@ -186,23 +186,23 @@ def test_scenario(src, expected_scenarios):
Scenario: a scenario
Given there is a foo
""",
[Step(GIVEN, "there is a foo", 3, 9, "Given ")],
[Step(GIVEN, "there is a foo", 3, 9, "Given")],
),
(
"""\
Feature: a feature
Scenario: a scenario
When I click the foo
""",
[Step(WHEN, "I click the foo", 3, 9, "When ")],
[Step(WHEN, "I click the foo", 3, 9, "When")],
),
(
"""\
Feature: a feature
Scenario: a scenario
Then I should see a foo
""",
[Step(THEN, "I should see a foo", 3, 9, "Then ")],
[Step(THEN, "I should see a foo", 3, 9, "Then")],
),
(
"""\
Expand All @@ -213,9 +213,9 @@ def test_scenario(src, expected_scenarios):
Then I should see a foo
""",
[
Step(GIVEN, "there is a foo", 3, 9, "Given "),
Step(WHEN, "I click the foo", 4, 9, "When "),
Step(THEN, "I should see a foo", 5, 9, "Then "),
Step(GIVEN, "there is a foo", 3, 9, "Given"),
Step(WHEN, "I click the foo", 4, 9, "When"),
Step(THEN, "I should see a foo", 5, 9, "Then"),
],
),
(
Expand All @@ -229,11 +229,11 @@ def test_scenario(src, expected_scenarios):
But I should not see more than one foo
""",
[
Step(GIVEN, "there is a foo", 3, 9, "Given "),
Step(GIVEN, "there is a second foo", 4, 9, "Given "),
Step(GIVEN, "there is a third foo", 5, 9, "And "),
Step(THEN, "I should see a foo", 6, 9, "Then "),
Step(THEN, "I should not see more than one foo", 7, 9, "But "),
Step(GIVEN, "there is a foo", 3, 9, "Given"),
Step(GIVEN, "there is a second foo", 4, 9, "Given"),
Step(GIVEN, "there is a third foo", 5, 9, "And"),
Step(THEN, "I should see a foo", 6, 9, "Then"),
Step(THEN, "I should not see more than one foo", 7, 9, "But"),
],
),
pytest.param(
Expand All @@ -242,7 +242,7 @@ def test_scenario(src, expected_scenarios):
Scenario: a scenario
When I click the foo""",
[
Step(WHEN, "I click the foo", 3, 9, "When "),
Step(WHEN, "I click the foo", 3, 9, "When"),
],
id="no_ending_newline",
),
Expand Down

0 comments on commit dad75f7

Please sign in to comment.