MCPcopy Create free account
hub / github.com/python/cpython / test_removed_file

Method test_removed_file

Lib/test/test_os/test_os.py:4979–4996  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4977 self.assertRaises(FileNotFoundError, entry.stat, follow_symlinks=False)
4978
4979 def test_removed_file(self):
4980 entry = self.create_file_entry()
4981 os.unlink(entry.path)
4982
4983 self.assertFalse(entry.is_dir())
4984 # On POSIX, is_dir() result depends if scandir() filled d_type or not
4985 if os.name == 'nt':
4986 self.assertTrue(entry.is_file())
4987 self.assertFalse(entry.is_symlink())
4988 if os.name == 'nt':
4989 self.assertRaises(FileNotFoundError, entry.inode)
4990 # don't fail
4991 entry.stat()
4992 entry.stat(follow_symlinks=False)
4993 else:
4994 self.assertGreater(entry.inode(), 0)
4995 self.assertRaises(FileNotFoundError, entry.stat)
4996 self.assertRaises(FileNotFoundError, entry.stat, follow_symlinks=False)
4997
4998 def test_broken_symlink(self):
4999 if not os_helper.can_symlink():

Callers

nothing calls this directly

Calls 10

create_file_entryMethod · 0.95
assertFalseMethod · 0.80
assertTrueMethod · 0.80
assertGreaterMethod · 0.80
unlinkMethod · 0.45
is_dirMethod · 0.45
is_fileMethod · 0.45
is_symlinkMethod · 0.45
assertRaisesMethod · 0.45
statMethod · 0.45

Tested by

no test coverage detected