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

Method test_itemgetter

Lib/test/test_operator.py:708–721  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

706 self.assertEqual(f2(a), f(a))
707
708 def test_itemgetter(self):
709 itemgetter = self.module.itemgetter
710 a = 'ABCDE'
711 for proto in range(pickle.HIGHEST_PROTOCOL + 1):
712 with self.subTest(proto=proto):
713 f = itemgetter(2)
714 f2 = self.copy(f, proto)
715 self.assertEqual(repr(f2), repr(f))
716 self.assertEqual(f2(a), f(a))
717 # multiple gets
718 f = itemgetter(2, 0, 4)
719 f2 = self.copy(f, proto)
720 self.assertEqual(repr(f2), repr(f))
721 self.assertEqual(f2(a), f(a))
722
723 def test_methodcaller(self):
724 methodcaller = self.module.methodcaller

Callers

nothing calls this directly

Calls 6

copyMethod · 0.95
itemgetterClass · 0.85
f2Function · 0.85
fFunction · 0.70
subTestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected