import pytest from aiatlas.connectors.labs.deepseek import DOCS, DeepSeekConnector from aiatlas.sdk.facts import Target from tests.conftest import claims_of, extract_from_fixture, fixture_path @pytest.fixture def connector() -> DeepSeekConnector: return DeepSeekConnector() async def test_pricing(connector): facts = await extract_from_fixture(connector, Target(url=f"{DOCS}/quick_start/pricing", doc_type="pricing", key="pricing"), fixture_path("deepseek", "pricing.html")) models = {e.name: e for e in facts.entities if e.entity_type == "model"} assert set(models) == {"DeepSeek-V4.1-Flash", "DeepSeek-V4-Pro-0813"} flash = models["DeepSeek-V4.1-Flash"] assert flash.identifiers == {"deepseek_model_id": "deepseek-flash"} and {"deepseek-flash", "deepseek-v4-flash"} <= set(flash.aliases) c = claims_of(facts, "DeepSeek-V4.1-Flash") assert c["context_length"] == 1_000_000 and c["max_output_tokens"] == 384_000 assert c["tool_calling"] is True and c["structured_output"] is True and c["vision"] is True and c["reasoning"] is True assert claims_of(facts, "DeepSeek-V4-Pro-0813")["vision"] is False by_id = {p.provider_model_id: p for p in facts.prices} flash_p = by_id["deepseek-flash"] assert (flash_p.input_per_mtok, flash_p.cached_input_per_mtok, flash_p.output_per_mtok) == (0.3, 0.006, 1.2) assert flash_p.features["off_peak_input_per_mtok"] == 0.15 and flash_p.features["off_peak_output_per_mtok"] == 0.6 pro_p = by_id["deepseek-v4-pro"] assert (pro_p.input_per_mtok, pro_p.cached_input_per_mtok, pro_p.output_per_mtok) == (1.32, 0.044, 3.96) assert pro_p.provider.identifiers["registry_provider"] == "deepseek" async def test_changelog(connector): facts = await extract_from_fixture(connector, Target(url=f"{DOCS}/updates", doc_type="listing", key="changelog"), fixture_path("deepseek", "updates.html")) assert len(facts.events) >= 20 first = facts.events[0] assert first.summary == "DeepSeek: DeepSeek-V4.1-Flash Release" and first.effective_at.date().isoformat() == "2026-09-10" and first.category == "release" assert "deepseek-flash" in first.meta["summary"] or "V4.1" in first.meta["summary"] assert len({e.dedupe_key for e in facts.events}) == len(facts.events) news = [t for t in facts.targets if t.doc_type == "news_index"] assert len(news) == 1 and news[0].url == f"{DOCS}/news/news260910" async def test_news_index(connector): facts = await extract_from_fixture(connector, Target(url=f"{DOCS}/news/news260910", doc_type="news_index", key="news_index"), fixture_path("deepseek", "news-260910.html")) events = {e.source_url: e for e in facts.events} assert len(events) >= 15 pro = events[f"{DOCS}/news/news260813"] assert pro.summary == "DeepSeek: DeepSeek-V4-Pro GA Release" and pro.effective_at.date().isoformat() == "2026-08-13" and pro.category == "release" assert events[f"{DOCS}/news/news250120"].summary == "DeepSeek: DeepSeek-R1 Release" assert any(t.needs_llm and t.meta.get("llm_task") == "release_announcement" for t in facts.targets)