From 1f627ad807786deac75556d814d9346b211a522e Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Tue, 3 Feb 2026 01:25:50 +0000 Subject: [PATCH] Add test files --- tests/conftest.py | 138 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 tests/conftest.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..0a992e0 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,138 @@ +"""Pytest configuration and fixtures.""" + +import os +import sys +from pathlib import Path + +import pytest + +sys.path.insert(0, str(Path(__file__).parent.parent)) + + +@pytest.fixture(scope="session") +def project_root(): + """Get the project root directory.""" + return Path(__file__).parent.parent + + +@pytest.fixture +def temp_dir(tmp_path): + """Create a temporary directory for tests.""" + return tmp_path + + +@pytest.fixture +def sample_openapi_content(): + """Sample OpenAPI specification content.""" + return """ +openapi: "3.0.0" +info: + title: Sample API + version: "1.0.0" + description: A sample API for testing + +paths: + /users: + get: + summary: List users + description: Get a list of all users + operationId: listUsers + responses: + '200': + description: Successful response + + /users/{id}: + get: + summary: Get user by ID + operationId: getUser + parameters: + - name: id + in: path + required: true + schema: + type: integer + responses: + '200': + description: User found + '404': + description: User not found +""" + + +@pytest.fixture +def sample_readme_content(): + """Sample README content.""" + return """# Project Title + +This is a sample project. + +## Installation + +Run `pip install` to install dependencies. + +## Usage + +```python +from project import main +main() +``` + +## API + +### `main()` + +The main entry point of the application. + +### `process_data(data)` + +Process the given data. + +**Parameters:** +- `data` (dict): The data to process + +**Returns:** +- dict: Processed data +""" + + +@pytest.fixture +def sample_python_content(): + """Sample Python code with docstrings.""" + return '''"""Sample module for testing.""" + +def example_function(param1, param2): + """Example function with parameters. + + Args: + param1: First parameter + param2: Second parameter + + Returns: + Combined result + """ + return param1 + param2 + + +class ExampleClass: + """Example class for testing. + + Attributes: + value: The stored value + """ + + def __init__(self, initial_value=0): + """Initialize with a value. + + Args: + initial_value: Starting value + """ + self.value = initial_value + + def get_value(self): + """Get the current value. + + Returns: + The current value + """ + return self.value +'''