Spaces:
Running on Zero
Running on Zero
File size: 1,013 Bytes
db06ffa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 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()
|