MCPcopy
hub / github.com/wkentaro/gdown / _test_cli_with_md5

Function _test_cli_with_md5

tests/test___main__.py:21–33  ·  view source on GitHub ↗
(
    url_or_id: str, md5: str, options: list[str] | None = None
)

Source from the content-addressed store, hash-verified

19
20
21def _test_cli_with_md5(
22 url_or_id: str, md5: str, options: list[str] | None = None
23) -> None:
24 # We can't use NamedTemporaryFile because Windows doesn't allow the subprocess
25 # to write the file created by the parent process.
26 with tempfile.TemporaryDirectory() as d:
27 file_path = os.path.join(d, "file")
28 cmd = ["gdown", "--no-cookies", url_or_id, "-O", file_path]
29 if options is not None:
30 cmd.extend(options)
31 subprocess.call(cmd)
32 assert os.path.exists(file_path)
33 _assert_filehash(path=file_path, hash=f"md5:{md5}")
34
35
36def _test_cli_with_content(url_or_id: str, content: str) -> None:

Calls 1

_assert_filehashFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…