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

Method __getitem__

Lib/test/test_descr.py:4008–4009  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

4006 self.assertEqual(list.__getitem__([1,2,3], slice(2)), [1,2])
4007 class L(list):
4008 def __getitem__(self, x):
4009 return list.__getitem__(self, x)
4010 self.assertEqual(L([1,2,3])[:2], [1,2])
4011 self.assertEqual(L([1,2,3])[slice(2)], [1,2])
4012 self.assertEqual(L([1,2,3]).__getitem__(slice(2)), [1,2])

Callers

nothing calls this directly

Calls 1

__getitem__Method · 0.45

Tested by

no test coverage detected