Update multiline example for step arg defixturing

This commit is contained in:
Paul "TBBle" Hampson 2022-06-28 19:47:31 +10:00 committed by GitHub
parent a75fc05250
commit 32a9593e3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -429,18 +429,14 @@ step arguments and capture lines after first line (or some subset of them) into
pass
@given(parsers.parse("I have a step with:\n{text}"), target_fixture="i_have_text")
@given(parsers.parse("I have a step with:\n{text}"), target_fixture="text")
def i_have_text(text):
return text
@then("the text should be parsed with correct indentation")
def text_should_be_correct(i_have_text, text):
assert i_have_text == text == 'Some\nExtra\nLines'
Note that `then` step definition (`text_should_be_correct`) in this example uses `text` fixture which is provided
by a `given` step (`i_have_text`) argument with the same name (`text`). This possibility is described in
the `Step arguments are fixtures as well!`_ section.
def text_should_be_correct(text):
assert text == 'Some\nExtra\nLines'
Scenarios shortcut