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

Method test_programatic_function_string_list

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

Source from the content-addressed store, hash-verified

4347 self.assertIs(type(e), Perm)
4348
4349 def test_programatic_function_string_list(self):
4350 Perm = IntFlag('Perm', ['R', 'W', 'X'])
4351 lst = list(Perm)
4352 self.assertEqual(len(lst), len(Perm))
4353 self.assertEqual(len(Perm), 3, Perm)
4354 self.assertEqual(lst, [Perm.R, Perm.W, Perm.X])
4355 for i, n in enumerate('R W X'.split()):
4356 v = 1<<i
4357 e = Perm(v)
4358 self.assertEqual(e.value, v)
4359 self.assertEqual(type(e.value), int)
4360 self.assertEqual(e, v)
4361 self.assertEqual(e.name, n)
4362 self.assertIn(e, Perm)
4363 self.assertIs(type(e), Perm)
4364
4365 def test_programatic_function_iterable(self):
4366 Perm = IntFlag('Perm', (('R', 2), ('W', 8), ('X', 32)))

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