Download tests/test_tasks.py from BurnyCoder/novel-tokens-reasoning-diffusion-llm: direct link, hf CLI and curl.
- Browser
- Download file 1.48 kB
-
https://huggingface.co/BurnyCoder/novel-tokens-reasoning-diffusion-llm/resolve/main/tests/test_tasks.py
- Command line
-
hf download hf://BurnyCoder/novel-tokens-reasoning-diffusion-llm/tests/test_tasks.py
-
curl -L -o test_tasks.py https://huggingface.co/BurnyCoder/novel-tokens-reasoning-diffusion-llm/resolve/main/tests/test_tasks.py
1.48 kB
| """Ground truth and isolation checks that do not require model weights.""" | |
| from novel_tokens.tasks import CUPS, apply_moves, make_cup, panel, partition, normalize_number | |
| def test_swap_solver_and_delayed_boundary(): | |
| p = make_cup(tuple(range(4)), (0, 5), 0) | |
| assert apply_moves(tuple(range(4)), (0, 5)) == (1, 0, 3, 2) | |
| assert p.answer == "B" and p.mid == (1, 0, 2, 3) | |
| assert p.question != p.writer and p.reader != p.question | |
| assert make_cup(p.start,(0,3),2).writer == p.writer | |
| assert make_cup((2,0,3,1),(3,2,5),0).reader == p.reader | |
| assert CUPS[apply_moves(p.mid, p.program[-1:]).index(p.color)] == p.answer | |
| def test_disjoint_programs_and_balanced_primary_panel(): | |
| a = panel("cups", "valid", 128, 710) | |
| b = panel("cups", "test", 4096, 711) | |
| assert len({p.program for p in b}) == 4096 | |
| assert not {p.program for p in a} & {p.program for p in b} | |
| assert all(partition(p.program) == "test" for p in b) | |
| assert [sum(p.answer == c for p in b) for c in CUPS] == [1024]*4 | |
| assert a == panel("cups", "valid", 128, 710) | |
| def test_finite_fallback_and_numeric_verifier(): | |
| a = panel("cups1", "valid", 128, 710) | |
| assert len({p.key for p in a}) == len(a) and len({p.program for p in a}) == 1 | |
| assert normalize_number("-1,200.00") == "-1200" | |
| assert normalize_number("12.6") == "12.6" and normalize_number("2 and 3") is None | |
| assert not {p.key for p in panel("math1","train",100,1)} & {p.key for p in panel("math1","test",100,1)} | |