from __future__ import annotations from conftest import fixture_path from companyatlas.fetch import file_result from companyatlas.sdk import connector as C BASE = "https://www.acme-cloud.example" CFG = {"canonical_domain": "acme-cloud.example"} def _run(surface: str, name: str, path: str): # type: ignore[no-untyped-def] url = BASE + path return C.get("generic-html-v1").extract({"url": url, "surface": surface, "config": CFG}, file_result(fixture_path("generic_html", name), url=url)) def test_pricing_plans() -> None: ex = _run("pricing", "pricing.html", "/pricing") plans = {p.plan_name: p for p in ex.plans} assert set(plans) == {"Starter", "Pro", "Enterprise"} assert plans["Starter"].price == 29 and plans["Starter"].currency == "USD" and plans["Starter"].billing_period == "month" assert plans["Pro"].unit == "user" and "SSO & SAML" in plans["Pro"].features assert plans["Enterprise"].contact_sales and plans["Enterprise"].billing_period == "contact" and plans["Enterprise"].price is None assert {d.surface.value for d in ex.discovered} >= {"careers", "docs", "legal_terms", "feed"} def test_leadership_people() -> None: ex = _run("leadership", "leadership.html", "/about/leadership") people = {p.name: p for p in ex.people} assert people["Jane Doe"].role_category == "ceo" and people["Jane Doe"].is_executive assert people["María García-López"].role_category == "cto" assert people["Tom O'Neill"].role_category == "vp" and not people["Tom O'Neill"].is_executive assert people["Samuel Adebayo"].role_category == "chair" and people["Lin Wei"].role_category == "board" assert "Meet the people" not in people def test_locations_never_invent() -> None: ex = _run("locations", "locations.html", "/company/locations") locs = {loc.name: loc for loc in ex.locations} assert locs["San Francisco (Headquarters)"].kind == "headquarters" and locs["San Francisco (Headquarters)"].country == "US" assert locs["San Francisco (Headquarters)"].address_text.startswith("548 Market Street") assert locs["Toronto"].country == "CA" and locs["Toronto"].region == "ON" and locs["Toronto"].address_text is None assert locs["Dublin Data Center"].kind == "data_center" and locs["Dublin Data Center"].country == "IE" assert locs["London"].city == "London" and locs["London"].country == "GB" def test_newsroom_items_with_dates() -> None: ex = _run("newsroom", "newsroom.html", "/news") assert len(ex.news) == 4 assert ex.news[0].title.startswith("Acme launches Atlas AI") and ex.news[0].published_at.date().isoformat() == "2026-09-10" assert ex.news[1].published_at.date().isoformat() == "2026-08-28" # from