]> jfr.im git - yt-dlp.git/blobdiff - test/test_downloader_http.py
[test:download] Raise on network errors (#10283)
[yt-dlp.git] / test / test_downloader_http.py
index 099ec2fff49b40f4a6b46c5663029319b9c343b8..faba0bc9c8d604b71c9da806dd96a7a4a2ee69dd 100644 (file)
@@ -38,9 +38,9 @@ def send_content_range(self, total=None):
                 end = int(mobj.group(2))
         valid_range = start is not None and end is not None
         if valid_range:
-            content_range = 'bytes %d-%d' % (start, end)
+            content_range = f'bytes {start}-{end}'
             if total:
-                content_range += '/%d' % total
+                content_range += f'/{total}'
             self.send_header('Content-Range', content_range)
         return (end - start + 1) if valid_range else total
 
@@ -84,7 +84,7 @@ def download(self, params, ep):
         filename = 'testfile.mp4'
         try_rm(encodeFilename(filename))
         self.assertTrue(downloader.real_download(filename, {
-            'url': 'http://127.0.0.1:%d/%s' % (self.port, ep),
+            'url': f'http://127.0.0.1:{self.port}/{ep}',
         }), ep)
         self.assertEqual(os.path.getsize(encodeFilename(filename)), TEST_SIZE, ep)
         try_rm(encodeFilename(filename))