From b1a694e8f56222b21fda1400c311ad84985dfd00 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Tue, 21 Nov 2023 20:18:56 -0800 Subject: [PATCH] oop, make mypi and flake8 happy --- dandi/support/digests.py | 5 +++-- dandi/support/tests/test_digests.py | 4 ++-- dandi/tests/test_download.py | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dandi/support/digests.py b/dandi/support/digests.py index db89086fe..d9403e1f4 100644 --- a/dandi/support/digests.py +++ b/dandi/support/digests.py @@ -170,8 +170,9 @@ def check_digests( break if digest_type is None: raise RuntimeError( - f"No digest found matching those in priority list. Got {digests.keys()} digests with priority list {priority}" + f"No digest found matching those in priority list. " + f"Got {digests.keys()} digests with priority list {priority}" ) # return simple comparison - return get_digest(filepath, digest_type) == digest + return bool(get_digest(filepath, digest_type) == digest) diff --git a/dandi/support/tests/test_digests.py b/dandi/support/tests/test_digests.py index 724d056b6..62a24c48e 100644 --- a/dandi/support/tests/test_digests.py +++ b/dandi/support/tests/test_digests.py @@ -13,7 +13,7 @@ from pytest_mock import MockerFixture from .. import digests -from ..digests import Digester, get_zarr_checksum, check_digests +from ..digests import Digester, check_digests, get_zarr_checksum def test_digester(tmp_path): @@ -53,7 +53,7 @@ def test_digester(tmp_path): } -def test_check_digests(tmp_path: Path): +def test_check_digests(tmp_path: Path) -> None: # we should return True if the highest matching priority digest matches # the file digest, and false otherwise. f = tmp_path / "long.txt" diff --git a/dandi/tests/test_download.py b/dandi/tests/test_download.py index cd1c3747c..b8d24bc1d 100644 --- a/dandi/tests/test_download.py +++ b/dandi/tests/test_download.py @@ -153,7 +153,9 @@ def test_download_000027_resume( @pytest.mark.parametrize( "dlmode", (DownloadExisting.OVERWRITE_DIFFERENT, DownloadExisting.REFRESH) ) -def test_download_000027_digest(tmp_path: Path, dlmode, caplog): +def test_download_000027_digest( + tmp_path: Path, dlmode: DownloadExisting, caplog: pytest.LogCaptureFixture +) -> None: from ..support.digests import Digester # capture logs to test whether downloads happen