Spaces:
Sleeping
Sleeping
| from pathlib import Path | |
| import pytest | |
| from data.loaders import load_json_file, load_question_banks | |
| from data.question import TSQuestion | |
| def test_load_json_file_roundtrip(fixture_bank_dir: Path): | |
| path = fixture_bank_dir / "PSML_questions.json" | |
| qs = load_json_file(path) | |
| assert len(qs) >= 6 | |
| assert all(isinstance(q, TSQuestion) for q in qs) | |
| assert qs[0].dataset == "PSML" | |
| def test_load_question_banks_directory(fixture_bank_dir: Path): | |
| pools = load_question_banks(str(fixture_bank_dir)) | |
| for d in ("PSML", "freshretailnet", "MIMIC", "causal_chambers"): | |
| assert d in pools | |
| assert len(pools[d]) >= 1 | |
| def test_load_question_banks_rejects_non_dir(): | |
| with pytest.raises(NotADirectoryError): | |
| load_question_banks("/nonexistent/path/that/is/not/a/dir") | |