"""Step definitions for documentation alignment tests.""" from pathlib import Path from behave import given, then, when @given("the {filename} documentation file exists") def step_doc_file_exists(context: object, filename: str) -> None: """Check that a documentation file exists.""" context.doc_path = Path(__file__).parent.parent.parent / "docs" / "reference" / filename assert context.doc_path.exists(), f"Documentation file not found: {context.doc_path}" @when("I read the {filename} documentation file") def step_read_doc_file(context: object, filename: str) -> None: """Read a documentation file.""" context.doc_path = Path(__file__).parent.parent.parent / "docs" / "reference" / filename context.doc_content = context.doc_path.read_text(encoding="utf-8") @then("the documentation should contain {text}") def step_should_contain(context: object, text: str) -> None: """Check that documentation contains specific text.""" # Remove quotes from the text parameter search_text = text.strip('"\'') assert search_text in context.doc_content, ( f"Expected text not found in documentation: {search_text}" ) @then("the documentation should not contain {text}") def step_should_not_contain(context: object, text: str) -> None: """Check that documentation does not contain specific text.""" # Remove quotes from the text parameter search_text = text.strip('"\'') assert search_text not in context.doc_content, ( f"Unexpected text found in documentation: {search_text}" )