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

Method test_replace

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

Source from the content-addressed store, hash-verified

2319 self.assertFileNotFound(q.stat)
2320
2321 def test_replace(self):
2322 P = self.cls(self.base)
2323 p = P / 'fileA'
2324 size = p.stat().st_size
2325 # Replacing a non-existing path.
2326 q = P / 'dirA' / 'fileAA'
2327 replaced_p = p.replace(q)
2328 self.assertEqual(replaced_p, q)
2329 self.assertEqual(q.stat().st_size, size)
2330 self.assertFileNotFound(p.stat)
2331 # Replacing another (existing) path.
2332 r = self.parser.join(TESTFN, 'dirB', 'fileB')
2333 replaced_q = q.replace(r)
2334 self.assertEqual(replaced_q, self.cls(r))
2335 self.assertEqual(os.stat(r).st_size, size)
2336 self.assertFileNotFound(q.stat)
2337
2338 def test_touch_common(self):
2339 P = self.cls(self.base)

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected