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

Method test_rename

Lib/test/test_pathlib/test_pathlib.py:2295–2310  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2293 q.hardlink_to(p)
2294
2295 def test_rename(self):
2296 P = self.cls(self.base)
2297 p = P / 'fileA'
2298 size = p.stat().st_size
2299 # Renaming to another path.
2300 q = P / 'dirA' / 'fileAA'
2301 renamed_p = p.rename(q)
2302 self.assertEqual(renamed_p, q)
2303 self.assertEqual(q.stat().st_size, size)
2304 self.assertFileNotFound(p.stat)
2305 # Renaming to a str of a relative path.
2306 r = self.parser.join(TESTFN, 'fileAAA')
2307 renamed_q = q.rename(r)
2308 self.assertEqual(renamed_q, self.cls(r))
2309 self.assertEqual(os.stat(r).st_size, size)
2310 self.assertFileNotFound(q.stat)
2311
2312 def test_replace(self):
2313 P = self.cls(self.base)

Callers

nothing calls this directly

Calls 6

assertFileNotFoundMethod · 0.95
clsMethod · 0.45
statMethod · 0.45
renameMethod · 0.45
assertEqualMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected