MCPcopy Index your code
hub / github.com/python/cpython / test_reporthook_0_bytes

Method test_reporthook_0_bytes

Lib/test/test_urllib.py:699–708  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

697 second_temp, hooktester)
698
699 def test_reporthook_0_bytes(self):
700 # Test on zero length file. Should call reporthook only 1 time.
701 report = []
702 def hooktester(block_count, block_read_size, file_size, _report=report):
703 _report.append((block_count, block_read_size, file_size))
704 srcFileName = self.createNewTempFile()
705 urllib.request.urlretrieve(self.constructLocalFileUrl(srcFileName),
706 os_helper.TESTFN, hooktester)
707 self.assertEqual(len(report), 1)
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

Callers

nothing calls this directly

Calls 4

createNewTempFileMethod · 0.95
constructLocalFileUrlMethod · 0.95
urlretrieveMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected