Skip to content

Commit a81fea3

Browse files
committed
added python tests
1 parent f5f54b0 commit a81fea3

File tree

3 files changed

+127
-1
lines changed

3 files changed

+127
-1
lines changed

python/pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ requires-python = ">=3.9"
77
dependencies = ["pydantic>=2.12.3"]
88

99
[dependency-groups]
10-
dev = ["black>=25.9.0", "datamodel-code-generator>=0.40.0"]
10+
dev = [
11+
"black>=25.9.0",
12+
"datamodel-code-generator>=0.40.0",
13+
"pytest>=8.4.2",
14+
]
1115

1216
[build-system]
1317
requires = ["uv_build>=0.9.5,<0.10.0"]

python/tests/test_examples.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import json
2+
import os
3+
from pathlib import Path
4+
5+
import pytest
6+
import tyx_schema
7+
8+
EXAMPLE_DIRECTORY = os.path.join(os.path.dirname(__file__), "..", "..", "examples")
9+
10+
11+
def test_examples(examples):
12+
for example in examples:
13+
content = Path(example).read_text()
14+
tyx_schema.TyXDocument(**json.loads(content))
15+
16+
17+
@pytest.fixture
18+
def examples():
19+
return [
20+
os.path.join(EXAMPLE_DIRECTORY, f)
21+
for f in os.listdir(EXAMPLE_DIRECTORY)
22+
if f.endswith(".tyx")
23+
]

python/uv.lock

Lines changed: 99 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)