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

Function test_tar_normal

tests/test_extractall.py:33–44  ·  view source on GitHub ↗
(tmp_path: Path, _tmp_extract_dir: str)

Source from the content-addressed store, hash-verified

31
32
33def test_tar_normal(tmp_path: Path, _tmp_extract_dir: str) -> None:
34 tar_path = str(tmp_path / "normal.tar")
35 with tarfile.open(name=tar_path, mode="w") as tf:
36 data = b"hello world"
37 info = tarfile.TarInfo(name="hello.txt")
38 info.size = len(data)
39 tf.addfile(tarinfo=info, fileobj=io.BytesIO(data))
40
41 result = extractall(path=tar_path, to=_tmp_extract_dir)
42
43 assert os.path.exists(os.path.join(_tmp_extract_dir, "hello.txt"))
44 assert len(result) == 1
45
46
47def test_zip_path_traversal(tmp_path: Path, _tmp_extract_dir: str) -> None:

Callers

nothing calls this directly

Calls 1

extractallFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…