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

Method test_tuple_pack

Lib/test/test_capi/test_tuple.py:105–122  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

103 tuple_fromarray(NULL, PY_SSIZE_T_MAX)
104
105 def test_tuple_pack(self):
106 # Test PyTuple_Pack()
107 pack = _testlimitedcapi.tuple_pack
108
109 self.assertEqual(pack(0), ())
110 self.assertEqual(pack(1, [1]), ([1],))
111 self.assertEqual(pack(2, [1], [2]), ([1], [2]))
112
113 self._tracked(pack(1, [1]))
114 self._tracked(pack(2, [1], b'abc'))
115 self._not_tracked(pack(2, 42, b'abc'))
116
117 self.assertRaises(SystemError, pack, PY_SSIZE_T_MIN)
118 self.assertRaises(SystemError, pack, -1)
119 self.assertRaises(MemoryError, pack, PY_SSIZE_T_MAX)
120
121 # CRASHES pack(1, NULL)
122 # CRASHES pack(2, [1])
123
124 def check_tuple_from_pair(self, from_pair):
125 self.assertEqual(type(from_pair(1, 2)), tuple)

Callers

nothing calls this directly

Calls 5

_trackedMethod · 0.95
_not_trackedMethod · 0.95
packFunction · 0.85
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected