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

Method test_tuple_new

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

Source from the content-addressed store, hash-verified

51 # CRASHES check(NULL)
52
53 def test_tuple_new(self):
54 # Test PyTuple_New()
55 tuple_new = _testlimitedcapi.tuple_new
56 size = _testlimitedcapi.tuple_size
57 checknull = _testcapi._check_tuple_item_is_NULL
58
59 tup1 = tuple_new(0)
60 self.assertEqual(tup1, ())
61 self.assertEqual(size(tup1), 0)
62 self.assertIs(type(tup1), tuple)
63 self._not_tracked(tup1)
64
65 tup2 = tuple_new(1)
66 self.assertIs(type(tup2), tuple)
67 self.assertEqual(size(tup2), 1)
68 self.assertIsNot(tup2, tup1)
69 self.assertTrue(checknull(tup2, 0))
70 self._tracked(tup2)
71
72 self.assertRaises(SystemError, tuple_new, -1)
73 self.assertRaises(SystemError, tuple_new, PY_SSIZE_T_MIN)
74 self.assertRaises(MemoryError, tuple_new, PY_SSIZE_T_MAX)
75
76
77 def test_tuple_fromarray(self):

Callers

nothing calls this directly

Calls 7

_not_trackedMethod · 0.95
_trackedMethod · 0.95
assertIsNotMethod · 0.80
assertTrueMethod · 0.80
assertEqualMethod · 0.45
assertIsMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected