35 lines
1021 B
Python
35 lines
1021 B
Python
"""Smoke tests for codex.models dataclasses."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from codex.models import Chunk, Citation, CodeLink, Paper
|
|
|
|
|
|
def test_paper_defaults() -> None:
|
|
"""Paper(id=..., title=...) has correct optional-field defaults."""
|
|
p = Paper(id="2301.00001", title="T")
|
|
assert p.openalex_id is None
|
|
assert p.authors == []
|
|
assert p.year is None
|
|
|
|
|
|
def test_chunk_required_fields() -> None:
|
|
"""Chunk(paper_id=..., ord=..., content=...) has id=None and embedding=None."""
|
|
c = Chunk(paper_id="x", ord=0, content="c")
|
|
assert c.id is None
|
|
assert c.embedding is None
|
|
|
|
|
|
def test_citation_fields() -> None:
|
|
"""Citation(citing_id=..., cited_id=...) has context=None."""
|
|
cit = Citation(citing_id="a", cited_id="b")
|
|
assert cit.context is None
|
|
|
|
|
|
def test_codelink_fields() -> None:
|
|
"""CodeLink(symbol=...) has paper_id=None, role=None, and id=None."""
|
|
cl = CodeLink(symbol="foo")
|
|
assert cl.paper_id is None
|
|
assert cl.role is None
|
|
assert cl.id is None
|