| 1 |
@issue |
| 2 |
Feature: Issue 547 -- behave crashes when adding a step definition with optional parts |
| 3 |
|
| 4 |
. NOTE: cfparse/parse matcher conflict issue w/ CTOR init code. |
| 5 |
|
| 6 |
Scenario: Syndrome w/ cfparse |
| 7 |
Given a new working directory |
| 8 |
And a file named "features/environment.py" with: |
| 9 |
""" |
| 10 |
from behave import register_type, use_step_matcher |
| 11 |
import parse |
| 12 |
|
| 13 |
@parse.with_pattern(r"optional\s+") |
| 14 |
def parse_optional_word(text): |
| 15 |
return text.strip() |
| 16 |
|
| 17 |
use_step_matcher("cfparse") |
| 18 |
register_type(opt_=parse_optional_word) |
| 19 |
""" |
| 20 |
And a file named "features/steps/steps.py" with: |
| 21 |
""" |
| 22 |
from behave import step |
| 23 |
|
| 24 |
@step(u'some {:opt_?}word') |
| 25 |
def step_impl(context, opt_): |
| 26 |
pass |
| 27 |
""" |
| 28 |
And a file named "features/alice.feature" with: |
| 29 |
""" |
| 30 |
Feature: Alice |
| 31 |
Scenario: Bob |
| 32 |
Given some optional word |
| 33 |
""" |
| 34 |
When I run "behave -f plain features/alice.feature" |
| 35 |
Then it should pass |
| 36 |
And the command output should not contain: |
| 37 |
""" |
| 38 |
ValueError: format spec u'opt_?' not recognised |
| 39 |
""" |