(self)
| 162 | |
| 163 | @unittest.skipIf(ndarray is None, "needs _testbuffer") |
| 164 | def test_misc_add(self): |
| 165 | # PyNumber_Add(), PyNumber_InPlaceAdd() |
| 166 | add = _testcapi.number_add |
| 167 | inplaceadd = _testcapi.number_inplaceadd |
| 168 | |
| 169 | # test sq_concat/sq_inplace_concat slots |
| 170 | a, b, r = [1, 2], [3, 4], [1, 2, 3, 4] |
| 171 | self.assertEqual(add(a, b), r) |
| 172 | self.assertEqual(a, [1, 2]) |
| 173 | self.assertRaises(TypeError, add, ndarray([1], (1,)), 2) |
| 174 | a, b, r = [1, 2], [3, 4], [1, 2, 3, 4] |
| 175 | self.assertEqual(inplaceadd(a, b), r) |
| 176 | self.assertEqual(a, r) |
| 177 | self.assertRaises(TypeError, inplaceadd, ndarray([1], (1,)), 2) |
| 178 | |
| 179 | @unittest.skipIf(ndarray is None, "needs _testbuffer") |
| 180 | def test_misc_multiply(self): |
nothing calls this directly
no test coverage detected