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

Method test_replace

Lib/test/test_os/test_os.py:408–419  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

406 self.fdopen_helper('r', 100)
407
408 def test_replace(self):
409 TESTFN2 = os_helper.TESTFN + ".2"
410 self.addCleanup(os_helper.unlink, os_helper.TESTFN)
411 self.addCleanup(os_helper.unlink, TESTFN2)
412
413 create_file(os_helper.TESTFN, b"1")
414 create_file(TESTFN2, b"2")
415
416 os.replace(os_helper.TESTFN, TESTFN2)
417 self.assertRaises(FileNotFoundError, os.stat, os_helper.TESTFN)
418 with open(TESTFN2, 'r', encoding='utf-8') as f:
419 self.assertEqual(f.read(), "1")
420
421 def test_open_keywords(self):
422 f = os.open(path=__file__, flags=os.O_RDONLY, mode=0o777,

Callers

nothing calls this directly

Calls 7

addCleanupMethod · 0.80
create_fileFunction · 0.70
openFunction · 0.50
replaceMethod · 0.45
assertRaisesMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected