57 lines
1.1 KiB
Python
57 lines
1.1 KiB
Python
"""Configuration for Local Code Assistant tests."""
|
|
|
|
import pytest
|
|
from click.testing import CliRunner
|
|
|
|
|
|
@pytest.fixture
|
|
def cli_runner():
|
|
"""Create a CLI runner for testing."""
|
|
return CliRunner()
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_config():
|
|
"""Create a mock configuration."""
|
|
class MockConfig:
|
|
ollama_base_url = "http://localhost:11434"
|
|
ollama_model = "codellama"
|
|
ollama_timeout = 8000
|
|
streaming = True
|
|
default_language = "python"
|
|
temperature = 0.2
|
|
max_tokens = 4000
|
|
syntax_highlighting = True
|
|
clipboard_enabled = True
|
|
|
|
return MockConfig()
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_code():
|
|
"""Provide sample code for testing."""
|
|
return '''
|
|
def calculate_fibonacci(n: int) -> list[int]:
|
|
"""Calculate Fibonacci sequence up to n.
|
|
|
|
Args:
|
|
n: The number of Fibonacci numbers to generate.
|
|
|
|
Returns:
|
|
List of Fibonacci numbers.
|
|
"""
|
|
if n <= 0:
|
|
return []
|
|
if n == 1:
|
|
return [0]
|
|
|
|
fib = [0, 1]
|
|
for i in range(2, n):
|
|
fib.append(fib[i-1] + fib[i-2])
|
|
|
|
return fib
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print(calculate_fibonacci(10))
|
|
''' |