Add test suite and fix configuration for Python 3.12

- Add AGENTS.md with coding guidelines for AI agents
- Add comprehensive unit tests for Binance adapter (mocked)
- Add integration tests for Binance testnet connectivity
- Fix pydantic-settings v2 compatibility for nested settings
- Fix MarginType enum to handle lowercase API responses
- Update Python requirement to 3.12+ (pandas-ta dependency)
- Update ruff config to new lint section format
- Update PLAN.md to reflect completed milestones 1.1-1.3

32 tests passing with 81% coverage
This commit is contained in:
bnair123
2025-12-27 14:09:14 +04:00
parent 6f602c0d19
commit 17d51c4f78
8 changed files with 706 additions and 68 deletions

View File

@@ -1,6 +1,5 @@
"""Tests for configuration module."""
import os
from decimal import Decimal
import pytest
@@ -101,7 +100,6 @@ class TestConfigValidation:
def test_symbols_parsing_from_string(self) -> None:
"""Test comma-separated symbol parsing."""
# This tests the validator logic directly
from tradefinder.core.config import Settings
# Simulate what the validator does
input_str = "BTCUSDT, ETHUSDT, SOLUSDT"
@@ -114,18 +112,43 @@ class TestConfigValidation:
for tf in valid:
# These should not raise
assert tf in {
"1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h",
"6h", "8h", "12h", "1d", "3d", "1w", "1M"
"1m",
"3m",
"5m",
"15m",
"30m",
"1h",
"2h",
"4h",
"6h",
"8h",
"12h",
"1d",
"3d",
"1w",
"1M",
}
def test_invalid_timeframe(self) -> None:
"""Test invalid timeframe is rejected."""
from tradefinder.core.config import Settings
invalid_timeframes = ["2m", "10m", "2d", "1y", "invalid"]
valid_set = {
"1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h",
"6h", "8h", "12h", "1d", "3d", "1w", "1M"
"1m",
"3m",
"5m",
"15m",
"30m",
"1h",
"2h",
"4h",
"6h",
"8h",
"12h",
"1d",
"3d",
"1w",
"1M",
}
for tf in invalid_timeframes:
assert tf not in valid_set