diff --git a/src/nl2gherkin/exporters/pytest_bdd.py b/src/nl2gherkin/exporters/pytest_bdd.py index 0aa670e..7075ba6 100644 --- a/src/nl2gherkin/exporters/pytest_bdd.py +++ b/src/nl2gherkin/exporters/pytest_bdd.py @@ -62,7 +62,7 @@ def expected_result(): Dictionary mapping filenames to content. """ return { - "conftest.py": '''"""pytest configuration and fixtures.""" + "conftest.py": '"""pytest configuration and fixtures.""" import pytest from pytest_bdd import scenarios @@ -119,17 +119,9 @@ bdd_features_base_dir = features/ ", ".join(f'"{p}"' for p in params) if params else "" if params: - step_impl = f'''@{step_def}("{step_text}") -def {step_def}_{scenario_name}({", ".join(params)}): - """{stripped.split()[0]} step implementation.""" - pass -''' + step_impl = f'@pytest.{step_def}("{step_text}")\ndef {step_def}_{scenario_name}({', '.join(params)}):\n """{stripped.split()[0]} step implementation."""\n pass\n' else: - step_impl = f'''@{step_def}("{step_text}") -def {step_def}_{scenario_name}(): - """{stripped.split()[0]} step implementation.""" - pass -''' + step_impl = f'@{step_def}("{step_text}")\ndef {step_def}_{scenario_name}():\n """{stripped.split()[0]} step implementation."""\n pass\n' step_defs.append(step_impl)