sphinx_gherkindoc.parsers package

Sphinx-Gherkindoc Parsers.

class sphinx_gherkindoc.parsers.ExamplesTableClass(*args, **kwds)[source]

Bases: typing_extensions.Protocol

Protocol for an examples table class model.

tags: List[str]
class sphinx_gherkindoc.parsers.FeatureClass(*args, **kwds)[source]

Bases: typing_extensions.Protocol

Protocol for a feature class model.

examples: List[sphinx_gherkindoc.parsers.ExamplesTableClass]
scenarios: List[sphinx_gherkindoc.parsers.ScenarioClass]
tags: List[str]
class sphinx_gherkindoc.parsers.ScenarioClass(*args, **kwds)[source]

Bases: typing_extensions.Protocol

Protocol for a scenario class model.

examples: List[sphinx_gherkindoc.parsers.ExamplesTableClass]
steps: List[sphinx_gherkindoc.parsers.StepClass]
tags: List[str]
class sphinx_gherkindoc.parsers.StepClass(*args, **kwds)[source]

Bases: typing_extensions.Protocol

Protocol for a step class model.

keyword: str
name: str

Submodules

sphinx_gherkindoc.parsers.base module

Base classes for parsing.

class sphinx_gherkindoc.parsers.base.BaseModel(data)[source]

Bases: object

Base model for parsers.

property exists: bool

Return True if the feature exists.

Return type

bool

sphinx_gherkindoc.parsers.behave module

Helper functions for writing rST files with behave parser.

class sphinx_gherkindoc.parsers.behave.BehaveModel(data)[source]

Bases: sphinx_gherkindoc.parsers.base.BaseModel

Custom model for Behave-parsed objects.

property description: Optional[List[str]]

Add some reasonable assumptions about line breaks into descriptions.

Any line that ends in a period will have a newline added for separation.

Additionally, a newline will be added after the final line.

Return type

Optional[List[str]]

class sphinx_gherkindoc.parsers.behave.Feature(root_path, source_path)[source]

Bases: sphinx_gherkindoc.parsers.behave.BehaveModel

Feature model for Behave.

property examples: Union[behave.model.Examples, List]

Supports dummy feature-level examples.

Return type

Union[Examples, List]

property scenarios: List[sphinx_gherkindoc.parsers.behave.Scenario]

Wrap Behave Scenarios to include description processing.

Return type

List[Scenario]

class sphinx_gherkindoc.parsers.behave.Scenario(data)[source]

Bases: sphinx_gherkindoc.parsers.behave.BehaveModel

Make Scenarios inherit the BehaveModel description property.

sphinx_gherkindoc.parsers.pytest_bdd module

Helper functions for writing rST files.

class sphinx_gherkindoc.parsers.pytest_bdd.Background(data)[source]

Bases: sphinx_gherkindoc.parsers.pytest_bdd.PytestModel

Background model for Pytest-Bdd.

property steps: List[sphinx_gherkindoc.parsers.pytest_bdd.Step]

Return the steps from the background.

Return type

List[Step]

class sphinx_gherkindoc.parsers.pytest_bdd.Example(data)[source]

Bases: sphinx_gherkindoc.parsers.pytest_bdd.PytestModel

Example model for Pytest-Bdd.

property table: sphinx_gherkindoc.parsers.pytest_bdd.InlineTable

Return the Example table.

Return type

InlineTable

property tags: list

Return an empty list of tags, as Pytest-Bdd does not support example tags.

Return type

list

class sphinx_gherkindoc.parsers.pytest_bdd.Feature(root_path, source_path)[source]

Bases: sphinx_gherkindoc.parsers.pytest_bdd.PytestModel

Feature model for Pytest-Bdd.

property background: Optional[sphinx_gherkindoc.parsers.pytest_bdd.Background]

Return the background for the feature.

Return type

Optional[Background]

property examples: List[Optional[sphinx_gherkindoc.parsers.pytest_bdd.Example]]

Return feature-level examples, if any exist.

Return type

List[Optional[Example]]

property scenarios: List[sphinx_gherkindoc.parsers.pytest_bdd.Scenario]

Return all scenarios for the feature.

Return type

List[Scenario]

class sphinx_gherkindoc.parsers.pytest_bdd.InlineTable(headings, rows)

Bases: tuple

Create new instance of InlineTable(headings, rows)

property headings

Alias for field number 0

property rows

Alias for field number 1

class sphinx_gherkindoc.parsers.pytest_bdd.PytestModel(data)[source]

Bases: sphinx_gherkindoc.parsers.base.BaseModel

Base Model for Pytest-Bdd objects.

property description: Optional[List[str]]

Return description as a list of lines.

Return type

Optional[List[str]]

property keyword: str

Return the keyword for a given item.

Return type

str

property name: str

Return the name for a given item, if available.

Return type

str

class sphinx_gherkindoc.parsers.pytest_bdd.Scenario(data)[source]

Bases: sphinx_gherkindoc.parsers.pytest_bdd.PytestModel

Scenario model for Pytest-Bdd.

property examples: List[Optional[sphinx_gherkindoc.parsers.pytest_bdd.Example]]

Return examples from the scenario, if any exist.

Return type

List[Optional[Example]]

property steps: List[sphinx_gherkindoc.parsers.pytest_bdd.Step]

Return (non-background) steps for the scenario.

Return type

List[Step]

class sphinx_gherkindoc.parsers.pytest_bdd.Step(data)[source]

Bases: sphinx_gherkindoc.parsers.pytest_bdd.PytestModel

Step model for Pytest-Bdd.

property filename: str

Return the source file path for the step.

Return type

str

property line: int

Return the line number from the source file.

Return type

int

property name: str

Return text after keyword.

Return type

str

property step_type: str

Return the step type/keyword.

Return type

str

property table: Union[sphinx_gherkindoc.parsers.pytest_bdd.InlineTable, str]

Return the step table, if present.

Return type

Union[InlineTable, str]

property text: Union[List[str], str]

Return the (non-table) multi-line text from a step.

Return type

Union[List[str], str]