Skip to content

Commit a346575

Browse files
author
David Robertson
committed
Fix ignores in test_{scanner,file_downloader}.py
python/mypy#2427 (comment) describes the mypy change, in mypy 1.1.0
1 parent 974a07e commit a346575

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/scanner/test_file_downloader.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ async def _get(
6464

6565
# Mock _get so we don't actually try to download files.
6666
self.get_mock = Mock(side_effect=_get)
67-
self.downloader._get = self.get_mock # type: ignore[assignment]
67+
self.downloader._get = self.get_mock # type: ignore[method-assign]
6868

6969
async def test_download(self) -> None:
7070
"""Tests that downloading a file works."""
@@ -230,7 +230,7 @@ async def _get(
230230

231231
# Mock _get so we don't actually try to download files.
232232
self.get_mock = Mock(side_effect=_get)
233-
self.downloader._get = self.get_mock # type: ignore[assignment]
233+
self.downloader._get = self.get_mock # type: ignore[method-assign]
234234

235235
async def test_discover(self) -> None:
236236
"""Checks that the base URL to use to download files can be discovered via

tests/scanner/test_scanner.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async def download_file(
5252

5353
# Mock download_file so we don't actually try to download files.
5454
mcs = get_content_scanner()
55-
mcs.file_downloader.download_file = self.downloader_mock # type: ignore[assignment]
55+
mcs.file_downloader.download_file = self.downloader_mock # type: ignore[method-assign]
5656
self.scanner = mcs.scanner
5757

5858
async def test_scan(self) -> None:
@@ -161,7 +161,7 @@ async def test_cache_max_size_mismatching_hash(self) -> None:
161161
"""
162162
# Mock the _run_scan command so we can keep track of its call count.
163163
mock_runner = Mock(return_value=0)
164-
self.scanner._run_scan = mock_runner # type: ignore[assignment]
164+
self.scanner._run_scan = mock_runner # type: ignore[method-assign]
165165

166166
# Calculate the cache key for this file so we can look it up later.
167167
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:
269269
# It's tricky to give a value to `scanner._script` that makes `_run_scan` return 5
270270
# directly, so we just mock it here.
271271
run_scan_mock = Mock(return_value=5)
272-
self.scanner._run_scan = run_scan_mock # type: ignore[assignment]
272+
self.scanner._run_scan = run_scan_mock # type: ignore[method-assign]
273273

274274
# Scan the file, we'll check later that it wasn't cached.
275275
with self.assertRaises(FileDirtyError):
@@ -318,7 +318,7 @@ async def _scan_file(*args: Any) -> MediaDescription:
318318
return self.downloader_res
319319

320320
scan_mock = Mock(side_effect=_scan_file)
321-
self.scanner._scan_file = scan_mock # type: ignore[assignment]
321+
self.scanner._scan_file = scan_mock # type: ignore[method-assign]
322322

323323
# Request two scans of the same file at the same time.
324324
results = await asyncio.gather(

0 commit comments

Comments
 (0)