23 lines
783 B
Python
23 lines
783 B
Python
import importlib.util
|
|
from pathlib import Path
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parent.parent
|
|
ROCK_DATASET = REPO_ROOT / "training-data" / "scene-descriptions-rock.jsonl"
|
|
VALIDATOR_PATH = REPO_ROOT / "training" / "data" / "scene-descriptions" / "validate.py"
|
|
|
|
|
|
def _load_validator_module():
|
|
spec = importlib.util.spec_from_file_location("scene_validator", VALIDATOR_PATH)
|
|
module = importlib.util.module_from_spec(spec)
|
|
assert spec.loader is not None
|
|
spec.loader.exec_module(module)
|
|
return module
|
|
|
|
|
|
def test_training_data_rock_dataset_is_schema_valid():
|
|
validator = _load_validator_module()
|
|
errors, line_count, valid_count = validator.validate_file(str(ROCK_DATASET))
|
|
assert errors == []
|
|
assert line_count == 100
|
|
assert valid_count == 100
|