(self)
| 708 | self.assertEqual(report[0][2], 0) |
| 709 | |
| 710 | def test_reporthook_5_bytes(self): |
| 711 | # Test on 5 byte file. Should call reporthook only 2 times (once when |
| 712 | # the "network connection" is established and once when the block is |
| 713 | # read). |
| 714 | report = [] |
| 715 | def hooktester(block_count, block_read_size, file_size, _report=report): |
| 716 | _report.append((block_count, block_read_size, file_size)) |
| 717 | srcFileName = self.createNewTempFile(b"x" * 5) |
| 718 | urllib.request.urlretrieve(self.constructLocalFileUrl(srcFileName), |
| 719 | os_helper.TESTFN, hooktester) |
| 720 | self.assertEqual(len(report), 2) |
| 721 | self.assertEqual(report[0][2], 5) |
| 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 |
nothing calls this directly
no test coverage detected