the-stack-go / stackgo /tests /test_build_stack_dataset.py
s0duku's picture
Add generic end-to-end dataset builder and smoke-tested tooling
370fed4 verified
Raw History Blame Contribute Delete
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