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

Method assertS_IS

Lib/test/test_stat.py:100–115  ·  view source on GitHub ↗
(self, name, mode)

Source from the content-addressed store, hash-verified

98 return st_mode, modestr
99
100 def assertS_IS(self, name, mode):
101 # test format, lstrip is for S_IFIFO
102 fmt = getattr(self.statmod, "S_IF" + name.lstrip("F"))
103 self.assertEqual(self.statmod.S_IFMT(mode), fmt)
104 # test that just one function returns true
105 testname = "S_IS" + name
106 for funcname in self.format_funcs:
107 func = getattr(self.statmod, funcname, None)
108 if func is None:
109 if funcname == testname:
110 raise ValueError(funcname)
111 continue
112 if funcname == testname:
113 self.assertTrue(func(mode))
114 else:
115 self.assertFalse(func(mode))
116
117 @os_helper.skip_unless_working_chmod
118 def test_mode(self):

Callers 6

test_modeMethod · 0.95
test_directoryMethod · 0.95
test_linkMethod · 0.95
test_fifoMethod · 0.95
test_devicesMethod · 0.95
test_socketMethod · 0.95

Calls 5

assertTrueMethod · 0.80
assertFalseMethod · 0.80
funcFunction · 0.70
lstripMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected