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

Method render

src/pytest_bdd/parser.py:205–236  ·  view source on GitHub ↗

Render the scenario with the given context. Args: context (Mapping[str, Any]): The context for rendering steps. Returns: Scenario: A Scenario object with steps rendered based on the context.

(self, context: Mapping[str, Any])

Source from the content-addressed store, hash-verified

203 return self.all_background_steps + self._steps
204
205 def render(self, context: Mapping[str, Any]) -> Scenario:
206 """Render the scenario with the given context.
207
208 Args:
209 context (Mapping[str, Any]): The context for rendering steps.
210
211 Returns:
212 Scenario: A Scenario object with steps rendered based on the context.
213 """
214 base_steps = self.all_background_steps + self._steps
215 scenario_steps = [
216 Step(
217 name=render_string(step.name, context),
218 type=step.type,
219 indent=step.indent,
220 line_number=step.line_number,
221 keyword=step.keyword,
222 datatable=step.render_datatable(step.datatable, context) if step.datatable else None,
223 docstring=render_string(step.docstring, context) if step.docstring else None,
224 )
225 for step in base_steps
226 ]
227 return Scenario(
228 feature=self.feature,
229 keyword=self.keyword,
230 name=render_string(self.name, context),
231 line_number=self.line_number,
232 steps=scenario_steps,
233 tags=self.tags,
234 description=self.description,
235 rule=self.rule,
236 )
237
238
239@dataclass(eq=False)

Callers 2

scenario_wrapperFunction · 0.80
generate_codeFunction · 0.80

Calls 4

render_stringFunction · 0.85
render_datatableMethod · 0.80
StepClass · 0.70
ScenarioClass · 0.70

Tested by

no test coverage detected