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

Method test_copy

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

Source from the content-addressed store, hash-verified

665 "as second returned value")
666
667 def test_copy(self):
668 # Test that setting the filename argument works.
669 second_temp = "%s.2" % os_helper.TESTFN
670 self.registerFileForCleanUp(second_temp)
671 result = urllib.request.urlretrieve(self.constructLocalFileUrl(
672 os_helper.TESTFN), second_temp)
673 self.assertEqual(second_temp, result[0])
674 self.assertTrue(os.path.exists(second_temp), "copy of the file was not "
675 "made")
676 FILE = open(second_temp, 'rb')
677 try:
678 text = FILE.read()
679 FILE.close()
680 finally:
681 try: FILE.close()
682 except: pass
683 self.assertEqual(self.text, text)
684
685 def test_reporthook(self):
686 # Make sure that the reporthook works.

Callers

nothing calls this directly

Calls 9

constructLocalFileUrlMethod · 0.95
urlretrieveMethod · 0.80
assertTrueMethod · 0.80
openFunction · 0.50
assertEqualMethod · 0.45
existsMethod · 0.45
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected