zeroshotGPU / tests /test_schema.py
Arjunvir Singh
Initial commit: zeroshotGPU MVP with full eval surface
db06ffa
import unittest
from zsgdp.schema import Element, ParsedDocument
class SchemaTests(unittest.TestCase):
def test_element_content_prefers_markdown(self):
element = Element(
element_id="e1",
doc_id="d1",
page_num=1,
type="heading",
text="Heading",
markdown="## Heading",
)
self.assertEqual(element.content(), "## Heading")
def test_parsed_document_markdown_includes_page_boundary(self):
doc = ParsedDocument(doc_id="d1", source_path="sample.md", file_type="markdown")
doc.elements.append(
Element(
element_id="e1",
doc_id="d1",
page_num=1,
type="paragraph",
text="Hello world",
reading_order=1,
)
)
self.assertIn("<!-- page:1 -->", doc.to_markdown())
self.assertIn("Hello world", doc.to_markdown())
if __name__ == "__main__":
unittest.main()