Skip to content

Commit 67ab1f9

Browse files
committed
Inline methods that don't need to exist
1 parent be152c8 commit 67ab1f9

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

src/pytest_bdd/parser.py

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,13 @@ def render(self, context: Mapping[str, Any]) -> Scenario:
213213
base_steps = self.all_background_steps + self._steps
214214
scenario_steps = [
215215
Step(
216-
name=step.render_step_name(context),
216+
name=render_string(step.name, context),
217217
type=step.type,
218218
indent=step.indent,
219219
line_number=step.line_number,
220220
keyword=step.keyword,
221221
datatable=step.render_datatable(context),
222-
docstring=step.render_docstring(context),
222+
docstring=render_string(step.docstring, context) if step.docstring else None,
223223
)
224224
for step in base_steps
225225
]
@@ -329,19 +329,6 @@ def params(self) -> tuple[str, ...]:
329329
"""
330330
return tuple(frozenset(STEP_PARAM_RE.findall(self.name)))
331331

332-
def render_step_name(self, context: Mapping[str, Any]) -> str:
333-
"""
334-
Render the step name with the given context,
335-
but avoid replacing text inside angle brackets if context is missing.
336-
337-
Args:
338-
context (Mapping[str, Any]): The context for rendering the step name.
339-
340-
Returns:
341-
str: The rendered step name with parameters replaced only if they exist in the context.
342-
"""
343-
return render_string(self.name, context)
344-
345332
def render_datatable(self, context: Mapping[str, Any]) -> DataTable | None:
346333
"""
347334
Render the datatable with the given context,
@@ -361,19 +348,6 @@ def render_datatable(self, context: Mapping[str, Any]) -> DataTable | None:
361348
return rendered_datatable
362349
return None
363350

364-
def render_docstring(self, context: Mapping[str, Any]) -> str | None:
365-
"""
366-
Render the docstring with the given context,
367-
but avoid replacing text inside angle brackets if context is missing.
368-
369-
Args:
370-
context (Mapping[str, Any]): The context for rendering the docstring.
371-
372-
Returns:
373-
str: The rendered docstring with parameters replaced only if they exist in the context.
374-
"""
375-
return render_string(self.docstring, context) if self.docstring else None
376-
377351

378352
@dataclass(eq=False)
379353
class Background:

0 commit comments

Comments
 (0)