(self)
| 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() |
nothing calls this directly
no test coverage detected