(self)
| 722 | self.assertEqual(report[1][2], 5) |
| 723 | |
| 724 | def test_reporthook_8193_bytes(self): |
| 725 | # Test on 8193 byte file. Should call reporthook only 3 times (once |
| 726 | # when the "network connection" is established, once for the next 8192 |
| 727 | # bytes, and once for the last byte). |
| 728 | report = [] |
| 729 | def hooktester(block_count, block_read_size, file_size, _report=report): |
| 730 | _report.append((block_count, block_read_size, file_size)) |
| 731 | srcFileName = self.createNewTempFile(b"x" * 8193) |
| 732 | urllib.request.urlretrieve(self.constructLocalFileUrl(srcFileName), |
| 733 | os_helper.TESTFN, hooktester) |
| 734 | self.assertEqual(len(report), 3) |
| 735 | self.assertEqual(report[0][2], 8193) |
| 736 | self.assertEqual(report[0][1], 8192) |
| 737 | self.assertEqual(report[1][1], 8192) |
| 738 | self.assertEqual(report[2][1], 8192) |
| 739 | |
| 740 | |
| 741 | class urlretrieve_HttpTests(unittest.TestCase, FakeHTTPMixin): |
nothing calls this directly
no test coverage detected