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

Method test_misc_add

Lib/test/test_capi/test_number.py:164–177  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 3

addFunction · 0.50
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected