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

Method test_tuple_fromarray

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

Source from the content-addressed store, hash-verified

75
76
77 def test_tuple_fromarray(self):
78 # Test PyTuple_FromArray()
79 tuple_fromarray = _testcapi.tuple_fromarray
80
81 tup = tuple([i] for i in range(5))
82 copy = tuple_fromarray(tup)
83 self.assertEqual(copy, tup)
84 self._tracked(copy)
85
86 tup = tuple(42**i for i in range(5))
87 copy = tuple_fromarray(tup)
88 self.assertEqual(copy, tup)
89 self._not_tracked(copy)
90
91 tup = ()
92 copy = tuple_fromarray(tup)
93 self.assertIs(copy, tup)
94
95 copy = tuple_fromarray(NULL, 0)
96 self.assertIs(copy, ())
97
98 with self.assertRaises(SystemError):
99 tuple_fromarray(NULL, -1)
100 with self.assertRaises(SystemError):
101 tuple_fromarray(NULL, PY_SSIZE_T_MIN)
102 with self.assertRaises(MemoryError):
103 tuple_fromarray(NULL, PY_SSIZE_T_MAX)
104
105 def test_tuple_pack(self):
106 # Test PyTuple_Pack()

Callers

nothing calls this directly

Calls 5

_trackedMethod · 0.95
_not_trackedMethod · 0.95
assertEqualMethod · 0.45
assertIsMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected