Download flysim/tests/test_cases.py from nynefold/flysim-malecns: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/datasets/nynefold/flysim-malecns/resolve/main/flysim/tests/test_cases.py
- Command line
-
hf download hf://datasets/nynefold/flysim-malecns/flysim/tests/test_cases.py
-
curl -L -o test_cases.py https://huggingface.co/datasets/nynefold/flysim-malecns/resolve/main/flysim/tests/test_cases.py
1.29 kB
| """The engine-check fixture matches Shiu et al.'s notebooks (preregistration, 2.2).""" | |
| from pathlib import Path | |
| from flysim.validation.manifest import conditions, extract_from_notebooks, load_cases | |
| NB = Path(__file__).parent / "fixtures" / "shiu" | |
| def test_fixture_matches_notebooks(): | |
| found = extract_from_notebooks([NB / "example.ipynb", NB / "figures.ipynb"]) | |
| cases = load_cases() | |
| for group, ids in cases["groups"].items(): | |
| assert ids == found[group], group | |
| for name, rid in cases["readouts"].items(): | |
| assert rid == found[name], name | |
| def test_readouts_are_the_prereg_ids(): | |
| readouts = load_cases()["readouts"] | |
| assert readouts == {"MN9": 720575940660219265, "aBN1": 720575940630907434} | |
| def test_manifest_is_the_prereg_grid(): | |
| by_case: dict[str, list[float]] = {} | |
| for c in conditions(): | |
| by_case.setdefault(c.case, []).append(c.ladder) | |
| assert by_case == { | |
| "E1": [10, 20, 50, 100, 150, 200], | |
| "E2": [40, 100, 200], | |
| "E3": [0, 50, 100, 200], | |
| "E4": [40, 100, 140, 220], | |
| } | |
| keys = [c.key for c in conditions()] | |
| assert len(set(keys)) == len(keys) | |
| e3 = [c for c in conditions() if c.case == "E3"] | |
| assert all(c.groups[0] == ("sugar", 100) and c.groups[1][0] == "bitter" for c in e3) | |