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

Method test_rename

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

Source from the content-addressed store, hash-verified

2302 q.hardlink_to(p)
2303
2304 def test_rename(self):
2305 P = self.cls(self.base)
2306 p = P / 'fileA'
2307 size = p.stat().st_size
2308 # Renaming to another path.
2309 q = P / 'dirA' / 'fileAA'
2310 renamed_p = p.rename(q)
2311 self.assertEqual(renamed_p, q)
2312 self.assertEqual(q.stat().st_size, size)
2313 self.assertFileNotFound(p.stat)
2314 # Renaming to a str of a relative path.
2315 r = self.parser.join(TESTFN, 'fileAAA')
2316 renamed_q = q.rename(r)
2317 self.assertEqual(renamed_q, self.cls(r))
2318 self.assertEqual(os.stat(r).st_size, size)
2319 self.assertFileNotFound(q.stat)
2320
2321 def test_replace(self):
2322 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