File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 1010import sys
1111import tempfile
1212import unittest
13- from collections .abc import Iterator
14- from typing import Any , ClassVar
13+ from typing import ClassVar
1514from unittest .mock import Mock , patch
1615
1716import requests
@@ -163,11 +162,11 @@ def test_download_file_upper_length(self) -> None:
163162 self .assertEqual (self .file_length , temp_file .tell ())
164163
165164 # Download a file bigger than expected
166- def test_download_file_length_mismatch (self ) -> Iterator [ Any ] :
167- with self .assertRaises (exceptions . DownloadLengthMismatchError ):
168- # Force download_file to execute and raise the error since it is a
169- # context manager and returns Iterator[IO]
170- yield self . fetcher . download_file ( self . url , self . file_length - 4 )
165+ def test_download_file_length_mismatch (self ) -> None :
166+ with self .assertRaises (
167+ exceptions . DownloadLengthMismatchError
168+ ), self . fetcher . download_file ( self . url , self . file_length - 4 ):
169+ pass # we never get here as download_file() raises
171170
172171
173172# Run unit test.
You can’t perform that action at this time.
0 commit comments