Spaces:
Build error
Build error
Download tests/test_schema.py from Varun2007/pageparse.ai: direct link, hf CLI and curl.
- Browser
- Download file 917 Bytes
-
https://huggingface.co/spaces/Varun2007/pageparse.ai/resolve/main/tests/test_schema.py
- Command line
-
hf download hf://spaces/Varun2007/pageparse.ai/tests/test_schema.py
-
curl -L -o test_schema.py https://huggingface.co/spaces/Varun2007/pageparse.ai/resolve/main/tests/test_schema.py
917 Bytes
| # SPDX-FileCopyrightText: 2026 Team Centurions | |
| # SPDX-License-Identifier: AGPL-3.0-or-later | |
| import pytest | |
| from pydantic import ValidationError | |
| from pageparse.schema import Record, SourceParseResult | |
| def test_task_defaults(): | |
| t = Record(content="Buy milk") | |
| assert t.content == "Buy milk" | |
| assert t.priority is None | |
| assert t.status == "todo" | |
| assert t.confidence == 1.0 | |
| def test_task_invalid_priority(): | |
| with pytest.raises(ValidationError): | |
| Record(content="Test", priority="urgent") | |
| def test_task_invalid_status(): | |
| with pytest.raises(ValidationError): | |
| Record(content="Test", status="in_progress") | |
| def test_page_parse_result(): | |
| result = SourceParseResult( | |
| source_file="test.jpg", | |
| records=[Record(content="Task 1"), Record(content="Task 2", priority="high")], | |
| ) | |
| assert len(result.records) == 2 | |
| assert result.records[1].priority == "high" | |