Skip to content

Commit

Permalink
Add docstring for stacklevel param
Browse files Browse the repository at this point in the history
  • Loading branch information
youtux committed Aug 14, 2022
1 parent c7d3a1e commit f8ad87c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pytest_bdd/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ def given(
name: str | StepParser,
converters: dict[str, Callable] | None = None,
target_fixture: str | None = None,
stacklevel: int = 1, # TODO: Add it to the docstring
stacklevel: int = 1,
) -> Callable:
"""Given step decorator.
:param name: Step name or a parser object.
:param converters: Optional `dict` of the argument or parameter converters in form
{<param_name>: <converter function>}.
:param target_fixture: Target fixture name to replace by steps definition function.
:param stacklevel: Stack level to find the caller frame. This is used when injecting the step definition fixture.
:return: Decorator function for the step.
"""
Expand All @@ -95,14 +96,15 @@ def when(
name: str | StepParser,
converters: dict[str, Callable] | None = None,
target_fixture: str | None = None,
stacklevel: int = 1, # TODO: Add it to the docstring
stacklevel: int = 1,
) -> Callable:
"""When step decorator.
:param name: Step name or a parser object.
:param converters: Optional `dict` of the argument or parameter converters in form
{<param_name>: <converter function>}.
:param target_fixture: Target fixture name to replace by steps definition function.
:param stacklevel: Stack level to find the caller frame. This is used when injecting the step definition fixture.
:return: Decorator function for the step.
"""
Expand All @@ -113,14 +115,15 @@ def then(
name: str | StepParser,
converters: dict[str, Callable] | None = None,
target_fixture: str | None = None,
stacklevel: int = 1, # TODO: Add it to the docstring
stacklevel: int = 1,
) -> Callable:
"""Then step decorator.
:param name: Step name or a parser object.
:param converters: Optional `dict` of the argument or parameter converters in form
{<param_name>: <converter function>}.
:param target_fixture: Target fixture name to replace by steps definition function.
:param stacklevel: Stack level to find the caller frame. This is used when injecting the step definition fixture.
:return: Decorator function for the step.
"""
Expand All @@ -132,14 +135,16 @@ def step(
type_: Literal["given", "when", "then"] | None = None,
converters: dict[str, Callable] | None = None,
target_fixture: str | None = None,
stacklevel: int = 1, # TODO: Add it to the docstring
stacklevel: int = 1,
) -> Callable[[TCallable], TCallable]:
"""Generic step decorator.
:param name: Step name as in the feature file.
:param type_: Step type ("given", "when" or "then"). If None, this step will work for all the types.
:param converters: Optional step arguments converters mapping
:param target_fixture: Optional fixture name to replace by step definition
:param converters: Optional step arguments converters mapping.
:param target_fixture: Optional fixture name to replace by step definition.
:param stacklevel: Stack level to find the caller frame. This is used when injecting the step definition fixture.
:return: Decorator function for the step.
Example:
Expand Down

0 comments on commit f8ad87c

Please sign in to comment.