tests(tasklib): fix validation exception and add test package init

This commit is contained in:
Rai (Michael Pokorny)
2025-06-24 17:47:16 -07:00
parent 7d9eef2034
commit 444df1f1a0
2 changed files with 9 additions and 5 deletions

View File

@@ -0,0 +1,3 @@
"""
Test package for manager_utils
"""

View File

@@ -3,10 +3,9 @@ from pathlib import Path
import toml
import pytest
from agentydragon.tools.manager_utils.tasklib import TaskMeta, load_task, save_task
from ..tasklib import TaskMeta, load_task, save_task
SAMPLE = ''''''
++
SAMPLE = """+++
id = "99"
title = "Sample Task"
status = "Not started"
@@ -15,7 +14,7 @@ last_updated = "2023-01-01T12:00:00"
++
# Body here
'''
"""
def test_load_and_save(tmp_path):
md = tmp_path / '99-sample.md'
@@ -29,6 +28,8 @@ def test_load_and_save(tmp_path):
data = toml.loads(text.split('+++')[1])
assert data['status'] == 'Done'
from pydantic import ValidationError
def test_meta_model_validation():
with pytest.raises(ValueError):
with pytest.raises(ValidationError):
TaskMeta(id='a', title='t', status='bogus', dependencies='', last_updated='bad')