Download stackgo/tests/test_build_stack_dataset.py from s0duku/the-stack-go: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/datasets/s0duku/the-stack-go/resolve/main/stackgo/tests/test_build_stack_dataset.py
- Command line
-
hf download hf://datasets/s0duku/the-stack-go/stackgo/tests/test_build_stack_dataset.py
-
curl -L -o test_build_stack_dataset.py https://huggingface.co/datasets/s0duku/the-stack-go/resolve/main/stackgo/tests/test_build_stack_dataset.py
1.08 kB
| from stackgo.scripts import build_stack_dataset | |
| def test_dry_run_builds_all_stages(tmp_path, monkeypatch): | |
| calls = [] | |
| monkeypatch.setattr(build_stack_dataset, "_run", lambda name, command, dry_run: calls.append((name, command))) | |
| monkeypatch.setattr("sys.argv", [ | |
| "build-stack-dataset", | |
| "--index-dir", str(tmp_path / "index"), | |
| "--output", str(tmp_path / "dataset"), | |
| "--filtered-index-dir", str(tmp_path / "filtered"), | |
| "--content-dir", str(tmp_path / "contents"), | |
| "--min-stars-exclusive", "5", | |
| "--max-stars-exclusive", "11", | |
| "--skip-index-download", | |
| "--max-source-shards", "1", | |
| "--max-files", "3", | |
| "--with-samples", | |
| "--jobs", "2", | |
| "--dry-run", | |
| ]) | |
| build_stack_dataset.main() | |
| assert [name for name, _ in calls] == ["filter", "contents", "export", "samples"] | |
| export_command = calls[2][1] | |
| assert "--star-events-count-exclusive" in export_command | |
| assert "--star-events-count-max-exclusive" in export_command | |
| assert "11" in export_command | |