MCPcopy Create free account
hub / github.com/pytest-dev/pytest-bdd / as_contexts

Method as_contexts

src/pytest_bdd/parser.py:120–128  ·  view source on GitHub ↗

Generate contexts for the examples. Yields: Dict[str, Any]: A dictionary mapping parameter names to their values for each example row.

(self)

Source from the content-addressed store, hash-verified

118 self.examples.append([str(value) if value is not None else "" for value in values])
119
120 def as_contexts(self) -> Iterable[dict[str, Any]]:
121 """Generate contexts for the examples.
122
123 Yields:
124 Dict[str, Any]: A dictionary mapping parameter names to their values for each example row.
125 """
126 for row in self.examples:
127 assert len(self.example_params) == len(row)
128 yield dict(zip(self.example_params, row))
129
130 def __bool__(self) -> bool:
131 """Check if there are any examples.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected