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

Method test_list_get_item

Lib/test/test_capi/test_list.py:108–119  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

106 self.check_list_get_item(_testlimitedcapi.list_get_item_ref, TypeError)
107
108 def test_list_get_item(self):
109 # Test PyList_GET_ITEM()
110 get_item = _testcapi.list_get_item
111 lst = [1, 2, [1, 2, 3]]
112 self.assertEqual(get_item(lst, 0), 1)
113 self.assertEqual(get_item(lst, 2), [1, 2, 3])
114
115 # CRASHES for out of index: get_item(lst, 3)
116 # CRASHES for get_item(lst, PY_SSIZE_T_MIN)
117 # CRASHES for get_item(lst, PY_SSIZE_T_MAX)
118 # CRASHES get_item(21, 2)
119 # CRASHES get_item(NULL, 1)
120
121 def test_list_setitem(self):
122 # Test PyList_SetItem()

Callers

nothing calls this directly

Calls 2

get_itemFunction · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected