From 65b6d1e0c0308bca3585bcdd2deadb44a7d728b5 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Fri, 24 Nov 2023 15:52:30 +0000 Subject: [PATCH] Fix ignores in test_{scanner,file_downloader}.py https://github.com/python/mypy/issues/2427#issuecomment-1419206807 describes the mypy change, in mypy 1.1.0 --- tests/scanner/test_file_downloader.py | 4 ++-- tests/scanner/test_scanner.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/scanner/test_file_downloader.py b/tests/scanner/test_file_downloader.py index 589a283..dc3a37b 100644 --- a/tests/scanner/test_file_downloader.py +++ b/tests/scanner/test_file_downloader.py @@ -64,7 +64,7 @@ async def _get( # Mock _get so we don't actually try to download files. self.get_mock = Mock(side_effect=_get) - self.downloader._get = self.get_mock # type: ignore[assignment] + self.downloader._get = self.get_mock # type: ignore[method-assign] async def test_download(self) -> None: """Tests that downloading a file works.""" @@ -230,7 +230,7 @@ async def _get( # Mock _get so we don't actually try to download files. self.get_mock = Mock(side_effect=_get) - self.downloader._get = self.get_mock # type: ignore[assignment] + self.downloader._get = self.get_mock # type: ignore[method-assign] async def test_discover(self) -> None: """Checks that the base URL to use to download files can be discovered via diff --git a/tests/scanner/test_scanner.py b/tests/scanner/test_scanner.py index fcc37b1..8c5d35d 100644 --- a/tests/scanner/test_scanner.py +++ b/tests/scanner/test_scanner.py @@ -52,7 +52,7 @@ async def download_file( # Mock download_file so we don't actually try to download files. mcs = get_content_scanner() - mcs.file_downloader.download_file = self.downloader_mock # type: ignore[assignment] + mcs.file_downloader.download_file = self.downloader_mock # type: ignore[method-assign] self.scanner = mcs.scanner async def test_scan(self) -> None: @@ -161,7 +161,7 @@ async def test_cache_max_size_mismatching_hash(self) -> None: """ # Mock the _run_scan command so we can keep track of its call count. mock_runner = Mock(return_value=0) - self.scanner._run_scan = mock_runner # type: ignore[assignment] + self.scanner._run_scan = mock_runner # type: ignore[method-assign] # Calculate the cache key for this file so we can look it up later. cache_key = self.scanner._get_cache_key_for_file(MEDIA_PATH, None, None) @@ -269,7 +269,7 @@ async def test_dont_cache_exit_codes(self) -> None: # It's tricky to give a value to `scanner._script` that makes `_run_scan` return 5 # directly, so we just mock it here. run_scan_mock = Mock(return_value=5) - self.scanner._run_scan = run_scan_mock # type: ignore[assignment] + self.scanner._run_scan = run_scan_mock # type: ignore[method-assign] # Scan the file, we'll check later that it wasn't cached. with self.assertRaises(FileDirtyError): @@ -318,7 +318,7 @@ async def _scan_file(*args: Any) -> MediaDescription: return self.downloader_res scan_mock = Mock(side_effect=_scan_file) - self.scanner._scan_file = scan_mock # type: ignore[assignment] + self.scanner._scan_file = scan_mock # type: ignore[method-assign] # Request two scans of the same file at the same time. results = await asyncio.gather(