test: 테스트 커버리지 77% → 80% 달성 (issue #204)
Some checks failed
CI / test (pull_request) Has been cancelled
Some checks failed
CI / test (pull_request) Has been cancelled
신규/추가 테스트: - tests/test_logging_config.py: JSONFormatter, setup_logging 전체 커버 (14줄) - tests/test_strategies_base.py: BaseStrategy 추상 클래스 커버 (6줄) - tests/test_backup.py: BackupExporter 미커버 경로(빈 CSV, compress=True CSV, 포맷 실패 로깅, 기본 formats) + CloudStorage boto3 모킹 테스트 20개 (113줄) - tests/test_context.py: ContextSummarizer 전체 커버 22개 테스트 (50줄) 총 815개 테스트 통과, TOTAL 커버리지 80% (1046줄 미커버 / 5225줄 전체) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
32
tests/test_strategies_base.py
Normal file
32
tests/test_strategies_base.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""Tests for BaseStrategy abstract class."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
|
||||
from src.strategies.base import BaseStrategy
|
||||
|
||||
|
||||
class ConcreteStrategy(BaseStrategy):
|
||||
"""Minimal concrete strategy for testing."""
|
||||
|
||||
def evaluate(self, market_data: dict[str, Any]) -> dict[str, Any]:
|
||||
return {"action": "HOLD", "confidence": 50, "rationale": "test"}
|
||||
|
||||
|
||||
def test_base_strategy_cannot_be_instantiated() -> None:
|
||||
"""BaseStrategy cannot be instantiated directly (it's abstract)."""
|
||||
with pytest.raises(TypeError):
|
||||
BaseStrategy() # type: ignore[abstract]
|
||||
|
||||
|
||||
def test_concrete_strategy_evaluate_returns_decision() -> None:
|
||||
"""Concrete subclass must implement evaluate and return a dict."""
|
||||
strategy = ConcreteStrategy()
|
||||
result = strategy.evaluate({"close": [100.0, 101.0]})
|
||||
assert isinstance(result, dict)
|
||||
assert result["action"] == "HOLD"
|
||||
assert result["confidence"] == 50
|
||||
assert "rationale" in result
|
||||
Reference in New Issue
Block a user