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

Method test_programatic_function_string

Lib/test/test_enum.py:4317–4331  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4315 self.assertEqual(list(Open), [Open.WO, Open.RW, Open.CE])
4316
4317 def test_programatic_function_string(self):
4318 Perm = IntFlag('Perm', 'R W X')
4319 lst = list(Perm)
4320 self.assertEqual(len(lst), len(Perm))
4321 self.assertEqual(len(Perm), 3, Perm)
4322 self.assertEqual(lst, [Perm.R, Perm.W, Perm.X])
4323 for i, n in enumerate('R W X'.split()):
4324 v = 1<<i
4325 e = Perm(v)
4326 self.assertEqual(e.value, v)
4327 self.assertEqual(type(e.value), int)
4328 self.assertEqual(e, v)
4329 self.assertEqual(e.name, n)
4330 self.assertIn(e, Perm)
4331 self.assertIs(type(e), Perm)
4332
4333 def test_programatic_function_string_with_start(self):
4334 Perm = IntFlag('Perm', 'R W X', start=8)

Callers

nothing calls this directly

Calls 8

IntFlagClass · 0.90
listClass · 0.85
enumerateFunction · 0.85
assertInMethod · 0.80
PermClass · 0.70
assertEqualMethod · 0.45
splitMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected