verbose live UI + tool-level SSE events + Groq default + regression tests
This commit is contained in:
46
tests/test_yaml_datasets.py
Normal file
46
tests/test_yaml_datasets.py
Normal file
@@ -0,0 +1,46 @@
|
||||
"""Regression: dataset YAML files parse and have the expected shape.
|
||||
|
||||
Bug captured: schema_docs.yaml had values that began with a quote character
|
||||
(e.g. `gender: 'M' or 'F'.`), which YAML treats as a quoted scalar — anything
|
||||
after the closing quote is a parse error.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
DATASETS_DIR = Path(__file__).resolve().parent.parent / "api" / "datasets"
|
||||
DATASETS = [p.name for p in DATASETS_DIR.iterdir() if p.is_dir() and not p.name.startswith("_")]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dataset", DATASETS)
|
||||
def test_schema_docs_parses(dataset):
|
||||
docs = yaml.safe_load((DATASETS_DIR / dataset / "schema_docs.yaml").read_text())
|
||||
assert docs is not None
|
||||
assert "tables" in docs
|
||||
assert isinstance(docs["tables"], dict) and docs["tables"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dataset", DATASETS)
|
||||
def test_metrics_parses(dataset):
|
||||
metrics = yaml.safe_load((DATASETS_DIR / dataset / "metrics.yaml").read_text())
|
||||
assert metrics is not None
|
||||
assert "metrics" in metrics
|
||||
assert isinstance(metrics["metrics"], dict) and metrics["metrics"]
|
||||
|
||||
|
||||
def test_financial_columns_with_quotes_survive_parse():
|
||||
"""Specific regression: values that contain quoted codes (M, F, OWNER,
|
||||
PRIJEM, etc.) must parse without truncation."""
|
||||
docs = yaml.safe_load(
|
||||
(DATASETS_DIR / "financial" / "schema_docs.yaml").read_text()
|
||||
)
|
||||
cols = docs["tables"]["client"]["columns"]
|
||||
assert '"M"' in cols["gender"] and '"F"' in cols["gender"]
|
||||
|
||||
disp = docs["tables"]["disp"]["columns"]
|
||||
assert '"OWNER"' in disp["type"] and '"DISPONENT"' in disp["type"]
|
||||
|
||||
trans = docs["tables"]["trans"]["columns"]
|
||||
assert '"PRIJEM"' in trans["type"] and '"VYDAJ"' in trans["type"]
|
||||
Reference in New Issue
Block a user