Download tests/test_cli.py from dougvk/Unlimited-OCR-RDNA4: direct link, hf CLI and curl.
- Browser
- Download file 901 Bytes
-
https://huggingface.co/dougvk/Unlimited-OCR-RDNA4/resolve/main/tests/test_cli.py
- Command line
-
hf download hf://dougvk/Unlimited-OCR-RDNA4/tests/test_cli.py
-
curl -L -o test_cli.py https://huggingface.co/dougvk/Unlimited-OCR-RDNA4/resolve/main/tests/test_cli.py
901 Bytes
| import json | |
| from pathlib import Path | |
| from unlimited_ocr_rdna4.cli import run | |
| from unlimited_ocr_rdna4.infer import default_output_path | |
| def test_prepare_dry_run_json_after_subcommand(capsys, tmp_path) -> None: | |
| code = run( | |
| [ | |
| "prepare", | |
| "--model-dir", | |
| str(tmp_path / "model"), | |
| "--cache-dir", | |
| str(tmp_path / "cache"), | |
| "--dry-run", | |
| "--json", | |
| ] | |
| ) | |
| assert code == 0 | |
| payload = json.loads(capsys.readouterr().out) | |
| assert payload["schema_version"] == 1 | |
| assert payload["status"] == "dry-run" | |
| assert payload["prepared"] is False | |
| def test_no_command_returns_usage_error(capsys) -> None: | |
| assert run([]) == 2 | |
| assert "usage:" in capsys.readouterr().err | |
| def test_default_output_path() -> None: | |
| assert default_output_path(Path("invoice.pdf")) == Path("invoice.pdf.ocr.md") | |