SPB Git forge

spb/ai-atlas

Public
41commits 1branches 0releases
4.6 MBsize
maindefault branch
12 days agolast push
HTML 77.2% TypeScript 10.5% Python 9.6% JavaScript 2.5%
2.0 KB · 32 lines python
Raw Blame History
1from datetime import UTC, datetime23from aiatlas.connectors.labs.microsoft_research import FEED, MicrosoftResearchConnector, is_publication, paper_entity4from aiatlas.registry import org_ref5from aiatlas.sdk.extract.feeds import FeedItem6from aiatlas.sdk.facts import Facts, Target7from tests.conftest import extract_from_fixture, fixture_path8910async def test_feed():11    facts = await extract_from_fixture(MicrosoftResearchConnector(), Target(url=FEED, doc_type="feed", key="feed"), fixture_path("microsoft_research", "feed.xml"),12                                       content_type="application/rss+xml")13    assert len(facts.events) == 1014    first = facts.events[0]15    assert first.summary.startswith("Microsoft: GigaPath-Flash and GigaTIME-Flash") and first.effective_at.date().isoformat() == "2026-08-31"16    assert first.meta["categories"] == ["Research Blog"] and first.entity.name == "Microsoft"17    assert not [e for e in facts.entities if e.entity_type == "paper"]          # research-blog items are events, not publications18    assert len([t for t in facts.targets if t.doc_type == "news"]) == 10192021def test_publication_detection():22    blog = FeedItem(id="1", url="https://www.microsoft.com/en-us/research/blog/x/", title="X", summary=None, published_at=None, updated_at=None, categories=["Research Blog"])23    pub = FeedItem(id="2", url="https://www.microsoft.com/en-us/research/publication/y/", title="Y paper", summary="Abstract.", published_at=datetime(2026, 9, 1, tzinfo=UTC),24                   updated_at=None, authors=["A. One, B. Two and C. Three"], categories=["Publication"])25    assert not is_publication(blog) and is_publication(pub)26    facts = Facts()27    paper = paper_entity(facts, org_ref("microsoft"), pub)28    assert paper.entity_type == "paper" and paper.identifiers == {"url": pub.url}29    claims = {c.property: c.value for c in facts.claims}30    assert claims["authors"] == ["A. One", "B. Two", "C. Three"] and claims["published_at"] == "2026-09-01"31    assert facts.relations[0].predicate == "published_by"32