File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -206,13 +206,22 @@ def test_read_partial_file_too_much(self) -> None:
206206 self .assertEqual (file .read (20 ), b"12345" )
207207
208208 def test_partial_file_len (self ) -> None :
209- """Useful for `requests` internally."""
209+ """Useful for httpx internally."""
210210 file = PartialFileIO (self .file_path , size_limit = 5 )
211211 self .assertEqual (len (file ), 5 )
212212
213213 file = PartialFileIO (self .file_path , size_limit = 50 )
214214 self .assertEqual (len (file ), 9 )
215215
216+ def test_partial_file_fileno (self ) -> None :
217+ """We explicitly do not implement fileno() to avoid misuse.
218+
219+ httpx tries to use it to check file size which we don't want for PartialFileIO.
220+ """
221+ file = PartialFileIO (self .file_path , size_limit = 5 )
222+ with self .assertRaises (AttributeError ):
223+ file .fileno ()
224+
216225 def test_partial_file_seek_and_tell (self ) -> None :
217226 file = PartialFileIO (self .file_path , size_limit = 5 )
218227
You can’t perform that action at this time.
0 commit comments