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

Method test_ndarray_slice_zero_shape

Lib/test/test_buffer.py:1725–1743  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1723 self.assertRaises(TypeError, x.add_suboffsets)
1724
1725 def test_ndarray_slice_zero_shape(self):
1726 items = [1,2,3,4,5,6,7,8,9,10,11,12]
1727
1728 x = ndarray(items, shape=[12], format="L", flags=ND_WRITABLE)
1729 y = ndarray(items, shape=[12], format="L")
1730 x[4:4] = y[9:9]
1731 self.assertEqual(x.tolist(), items)
1732
1733 ml = memoryview(x)
1734 mr = memoryview(y)
1735 self.assertEqual(ml, x)
1736 self.assertEqual(ml, y)
1737 ml[4:4] = mr[9:9]
1738 self.assertEqual(ml.tolist(), items)
1739
1740 x = ndarray(items, shape=[3, 4], format="L", flags=ND_WRITABLE)
1741 y = ndarray(items, shape=[4, 3], format="L")
1742 x[1:2, 2:2] = y[1:2, 3:3]
1743 self.assertEqual(x.tolist(), carray(items, [3, 4]))
1744
1745 def test_ndarray_slice_multidim(self):
1746 shape_t = (2, 3, 5)

Callers

nothing calls this directly

Calls 2

carrayFunction · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected