File size: 917 Bytes
8c3e275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# 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"