MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_replace

Method test_replace

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

Source from the content-addressed store, hash-verified

404 self.fdopen_helper('r', 100)
405
406 def test_replace(self):
407 TESTFN2 = os_helper.TESTFN + ".2"
408 self.addCleanup(os_helper.unlink, os_helper.TESTFN)
409 self.addCleanup(os_helper.unlink, TESTFN2)
410
411 create_file(os_helper.TESTFN, b"1")
412 create_file(TESTFN2, b"2")
413
414 os.replace(os_helper.TESTFN, TESTFN2)
415 self.assertRaises(FileNotFoundError, os.stat, os_helper.TESTFN)
416 with open(TESTFN2, 'r', encoding='utf-8') as f:
417 self.assertEqual(f.read(), "1")
418
419 def test_open_keywords(self):
420 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