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

Method check_entry

Lib/test/test_os/test_os.py:4828–4856  ·  view source on GitHub ↗
(self, entry, name, is_dir, is_file, is_symlink)

Source from the content-addressed store, hash-verified

4826 scandir_iter.close()
4827
4828 def check_entry(self, entry, name, is_dir, is_file, is_symlink):
4829 self.assertIsInstance(entry, os.DirEntry)
4830 self.assertEqual(entry.name, name)
4831 self.assertEqual(entry.path, os.path.join(self.path, name))
4832 self.assertEqual(entry.inode(),
4833 os.stat(entry.path, follow_symlinks=False).st_ino)
4834
4835 entry_stat = os.stat(entry.path)
4836 self.assertEqual(entry.is_dir(),
4837 stat.S_ISDIR(entry_stat.st_mode))
4838 self.assertEqual(entry.is_file(),
4839 stat.S_ISREG(entry_stat.st_mode))
4840 self.assertEqual(entry.is_symlink(),
4841 os.path.islink(entry.path))
4842
4843 entry_lstat = os.stat(entry.path, follow_symlinks=False)
4844 self.assertEqual(entry.is_dir(follow_symlinks=False),
4845 stat.S_ISDIR(entry_lstat.st_mode))
4846 self.assertEqual(entry.is_file(follow_symlinks=False),
4847 stat.S_ISREG(entry_lstat.st_mode))
4848
4849 self.assertEqual(entry.is_junction(), os.path.isjunction(entry.path))
4850
4851 self.assert_stat_equal(entry.stat(),
4852 entry_stat,
4853 os.name == 'nt' and not is_symlink)
4854 self.assert_stat_equal(entry.stat(follow_symlinks=False),
4855 entry_lstat,
4856 os.name == 'nt')
4857
4858 def test_attributes(self):
4859 link = os_helper.can_hardlink()

Callers 1

test_attributesMethod · 0.95

Calls 10

assert_stat_equalMethod · 0.95
assertIsInstanceMethod · 0.80
islinkMethod · 0.80
is_junctionMethod · 0.80
assertEqualMethod · 0.45
joinMethod · 0.45
statMethod · 0.45
is_dirMethod · 0.45
is_fileMethod · 0.45
is_symlinkMethod · 0.45

Tested by

no test coverage detected