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

Method test_copy_dangling_symlink

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

Source from the content-addressed store, hash-verified

1475
1476 @needs_symlinks
1477 def test_copy_dangling_symlink(self):
1478 base = self.cls(self.base)
1479 source = base / 'source'
1480 target = base / 'target'
1481
1482 source.mkdir()
1483 source.joinpath('link').symlink_to('nonexistent')
1484
1485 self.assertRaises(FileNotFoundError, source.copy, target)
1486
1487 target2 = base / 'target2'
1488 result = source.copy(target2, follow_symlinks=False)
1489 self.assertEqual(result, target2)
1490 self.assertTrue(target2.joinpath('link').is_symlink())
1491 self.assertEqual(target2.joinpath('link').readlink(), self.cls('nonexistent'))
1492
1493 @needs_symlinks
1494 def test_copy_link_preserve_metadata(self):

Callers

nothing calls this directly

Calls 10

assertTrueMethod · 0.80
clsMethod · 0.45
mkdirMethod · 0.45
symlink_toMethod · 0.45
joinpathMethod · 0.45
assertRaisesMethod · 0.45
copyMethod · 0.45
assertEqualMethod · 0.45
is_symlinkMethod · 0.45
readlinkMethod · 0.45

Tested by

no test coverage detected