Skip to content

Commit

Permalink
Fixup import
Browse files Browse the repository at this point in the history
  • Loading branch information
elchupanebrej committed Oct 5, 2024
1 parent 2128bae commit 6feddb4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
3 changes: 1 addition & 2 deletions Features/Steps to step definition bounding.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Feature: Gherkin steps bounding to steps definitions
And File "conftest.py" with content:
"""python
from pytest_bdd import given, when, then, step
from cucumber_messages import DataTable
from pytest import fixture
# pytest fixtures could be used from step definitions, so some
Expand Down Expand Up @@ -54,7 +53,7 @@ Feature: Gherkin steps bounding to steps definitions
@then('there are passed steps by kind:')
def check_step_counter(step, step_counter):
# Step datatables data could be accessed in the next manner
step_data_table: DataTable = step.data_table
step_data_table = step.data_table
oracle_results_header = [cell.value for cell in step_data_table.rows[0].cells]
oracle_results_values = [int(cell.value) for cell in step_data_table.rows[1].cells]
oracle_result = dict(zip(oracle_results_header, oracle_results_values))
Expand Down
18 changes: 16 additions & 2 deletions src/pytest_bdd/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,21 @@ def given_beautiful_article(article):
import warnings
from contextlib import suppress
from inspect import getfile, getsourcelines
from typing import Any, Callable, Collection, Dict, Iterable, Iterator, Mapping, Optional, Sequence, Set, Union, cast
from typing import (
Any,
Callable,
Collection,
Dict,
Iterable,
Iterator,
Mapping,
Optional,
Sequence,
Set,
Type,
Union,
cast,
)
from uuid import uuid4
from warnings import warn

Expand Down Expand Up @@ -351,7 +365,7 @@ class Definition:
anonymous_group_names: Optional[Collection[str]] = attrib()
converters: Dict[str, Callable] = attrib()
params_fixtures_mapping: Union[ # type: ignore[valid-type]
Collection[str], Mapping[Union[str, type[Ellipsis]], Union[str, type[Ellipsis], None]], Any
Collection[str], Mapping[Union[str, Type[Ellipsis]], Union[str, type[Ellipsis], None]], Any
] = attrib()
param_defaults: dict = attrib()
target_fixtures: Sequence[str] = attrib()
Expand Down
9 changes: 5 additions & 4 deletions src/pytest_bdd/testing_utils.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from functools import partial
from itertools import islice
from operator import attrgetter
from typing import Optional

from cucumber_messages import DataTable
from typing import TYPE_CHECKING, Optional

from pytest_bdd.utils import compose

if TYPE_CHECKING: # pragma: no cover
from cucumber_messages import DataTable


def data_table_to_dicts(data_table: Optional[DataTable]):
def data_table_to_dicts(data_table: Optional["DataTable"]):
if data_table is None:
return {}

Expand Down

0 comments on commit 6feddb4

Please sign in to comment.