Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behave generic step definition decorator #200

Merged
merged 3 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Fixed
- (Python) Fix index failures from partial parameter type matches ([#196](https://github.com/cucumber/language-service/pull/196))
- (Python) Unexpected spaces and commas in generated step definitions ([#160](https://github.com/cucumber/language-service/issues/160))
- (Rust) Support for r# raw strings with step definition patterns ([#176](https://github.com/cucumber/language-service/pull/176))
- (Rust) Line continuation characters in rust step definition patterns ([#179](https://github.com/cucumber/language-service/pull/179))
- (Python) Unexpected spaces and commas in generated step definitions ([#160](https://github.com/cucumber/language-service/issues/160))

### Added
- (Python) Support for u-strings with step definition patterns ([#173](https://github.com/cucumber/language-service/pull/173))
- (Python) Support for behave's generic step definition decorator ([#200](https://github.com/cucumber/language-service/pull/200))
- (Go) Support for Godog step definitions ([#130](https://github.com/cucumber/language-service/pull/130))

## [1.4.1] - 2023-07-16
Expand Down
2 changes: 1 addition & 1 deletion src/language/pythonLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const pythonLanguage: Language = {
arguments: (argument_list (string) @expression)
)
)
(#match? @method "(given|when|then)")
(#match? @method "(given|when|then|step)")
) @root
`,
],
Expand Down
10 changes: 4 additions & 6 deletions test/language/testdata/python/StepDefinitions.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
"""Port of givens for testdata."""
from behave import given
import datetime
import re
from behave import step, given, when, then


@given("a {uuid}")
@step("a {uuid}")
def step_given(context, uuid):
assert uuid

Expand All @@ -14,12 +12,12 @@ def step_date(context, date):
assert date


@given("a {planet}")
@when("a {planet}")
def step_planet(context, planet):
assert planet


@given("an {undefined-parameter}")
@then("an {undefined-parameter}")
def step_undef(context, planet):
assert planet

Expand Down