Skip to content

Commit

Permalink
style: pre-commit.ci auto fixes [...]
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Oct 15, 2024
1 parent 5f9026a commit 033f033
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions test/test_scripts_fetch_content.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import os
import pathlib
import urllib.request
from importlib.machinery import SourceFileLoader
from importlib.util import module_from_spec, spec_from_loader
from unittest.mock import MagicMock

import pytest

import pathlib
import taskgraph


Expand Down Expand Up @@ -96,6 +96,7 @@ def getheader(field):
if not raises:
raise


@pytest.mark.parametrize(
"expected,orig,dest",
[
Expand All @@ -105,19 +106,23 @@ def getheader(field):
(True, pathlib.Path("archive.tgz"), pathlib.Path("archive.tar.zst")),
(True, pathlib.Path("archive.zip"), pathlib.Path("archive.tar.zst")),
(True, pathlib.Path("archive.tar.xz"), pathlib.Path("archive.tar.zst")),
# Path is exactly the same
(False, pathlib.Path("archive"), pathlib.Path("archive")),
(False, pathlib.Path("archive.tar"), pathlib.Path("archive.tar")),
(False, pathlib.Path("archive.tgz"), pathlib.Path("archive.tgz")),
(False, pathlib.Path("archive.zip"), pathlib.Path("archive.zip")),
(False, pathlib.Path("file.txt"), pathlib.Path("file.txt")),
(False, pathlib.Path("archive.tar.zst"), pathlib.Path("archive.tar.zst")),
# Real edge cases
(False, pathlib.Path("python-3.8.10-amd64.exe"), pathlib.Path("python.exe")),
(False, pathlib.Path("9ee26e91-9b52-44ba-8d30-c0230dd587b2.bin"), pathlib.Path("model.esen.intgemm.alphas.bin")),
(
False,
pathlib.Path("9ee26e91-9b52-44ba-8d30-c0230dd587b2.bin"),
pathlib.Path("model.esen.intgemm.alphas.bin"),
),
],
)
def test_should_try_to_repack_archive(fetch_content_mod, orig, dest, expected):
assert fetch_content_mod.should_try_to_repack_archive(orig, dest) == expected, f"Failed for orig: {orig}, dest: {dest}, expected {expected} but received {not expected}"
assert (
fetch_content_mod.should_try_to_repack_archive(orig, dest) == expected
), f"Failed for orig: {orig}, dest: {dest}, expected {expected} but received {not expected}"

0 comments on commit 033f033

Please sign in to comment.