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

Method test_replace

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

Source from the content-addressed store, hash-verified

2310 self.assertFileNotFound(q.stat)
2311
2312 def test_replace(self):
2313 P = self.cls(self.base)
2314 p = P / 'fileA'
2315 size = p.stat().st_size
2316 # Replacing a non-existing path.
2317 q = P / 'dirA' / 'fileAA'
2318 replaced_p = p.replace(q)
2319 self.assertEqual(replaced_p, q)
2320 self.assertEqual(q.stat().st_size, size)
2321 self.assertFileNotFound(p.stat)
2322 # Replacing another (existing) path.
2323 r = self.parser.join(TESTFN, 'dirB', 'fileB')
2324 replaced_q = q.replace(r)
2325 self.assertEqual(replaced_q, self.cls(r))
2326 self.assertEqual(os.stat(r).st_size, size)
2327 self.assertFileNotFound(q.stat)
2328
2329 def test_touch_common(self):
2330 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