Lines Matching refs:nd
724 def ndarray_print(nd): argument
727 x = nd.tolist()
729 x = nd.tobytes()
730 if isinstance(nd, ndarray):
731 offset = nd.offset
732 flags = nd.flags
738 (x, nd.shape, nd.strides, nd.suboffsets, offset,
739 nd.format, nd.itemsize, flags))
970 nd = ndarray(ex, getbuf=PyBUF_FULL_RO)
971 lst = nd.tolist()
989 nd = ndarray(ex, getbuf=req)
990 self.verify(nd, obj=ex,
1086 nd = ndarray(ex, getbuf=PyBUF_SIMPLE)
1096 nd = ndarray(ex, getbuf=flags)
1097 self.assertTrue(is_contiguous(nd, 'F'))
1098 self.assertTrue(is_contiguous(nd, 'C'))
1101 nd = ndarray([9], [1])
1105 for c in (ndarray, nd.push, ndm.push):
1183 nd = ndarray([9], [1], flags=ND_VAREXPORT)
1184 self.assertRaises(ValueError, nd.push, [1], [1], flags=ND_VAREXPORT)
1187 nd = ndarray(b'123')
1188 self.assertRaises(BufferError, nd.push, [1], [1])
1189 self.assertRaises(BufferError, nd.pop)
1192 nd = ndarray([9], [1])
1193 nd.push([1], [1])
1194 m = memoryview(nd)
1195 self.assertRaises(BufferError, nd.push, [1], [1])
1196 self.assertRaises(BufferError, nd.pop)
1198 nd.pop()
1201 self.assertRaises(BufferError, nd.pop)
1202 del nd
1208 nd = ndarray(list(range(100)), shape=[1]*100)
1209 self.assertRaises(ValueError, get_pointer, nd, [5])
1211 nd = ndarray(list(range(12)), shape=[3,4])
1212 self.assertRaises(ValueError, get_pointer, nd, [2,3,4])
1213 self.assertRaises(ValueError, get_pointer, nd, [3,3])
1214 self.assertRaises(ValueError, get_pointer, nd, [-3,3])
1215 self.assertRaises(OverflowError, get_pointer, nd, [1<<64,3])
1219 nd = ndarray(ex, getbuf=PyBUF_SIMPLE)
1220 self.assertRaises(ValueError, nd.tolist)
1225 nd = ndarray(ex2)
1226 self.assertRaises(TypeError, nd.memoryview_from_buffer)
1228 nd = ndarray([(1,)*200], shape=[1], format='L'*200)
1229 self.assertRaises(TypeError, nd.memoryview_from_buffer)
1232 nd = ndarray(list(range(n)), shape=[1]*n)
1233 self.assertRaises(ValueError, nd.memoryview_from_buffer)
1236 nd = ndarray([1], shape=[1])
1238 self.assertRaises(TypeError, get_contiguous, nd, "xyz", 'C')
1239 self.assertRaises(OverflowError, get_contiguous, nd, 2**64, 'C')
1240 self.assertRaises(TypeError, get_contiguous, nd, PyBUF_READ, 961)
1241 self.assertRaises(UnicodeEncodeError, get_contiguous, nd, PyBUF_READ,
1243 self.assertRaises(ValueError, get_contiguous, nd, PyBUF_READ, 'Z')
1244 self.assertRaises(ValueError, get_contiguous, nd, 255, 'A')
1247 nd = ndarray([1], shape=[1])
1249 self.assertRaises(TypeError, cmp_contig, {}, nd)
1250 self.assertRaises(TypeError, cmp_contig, nd, {})
1253 nd = ndarray([1], shape=[1])
1256 self.assertRaises(TypeError, is_contiguous, nd, 201)
1261 nd = ndarray([1,2,3], shape=[3], flags=ND_VAREXPORT)
1262 m[0] = memoryview(nd)
1265 nd.push([1,2,3], shape=[3])
1266 m[i] = memoryview(nd)
1271 self.assertRaises(BufferError, nd.pop)
1272 del nd
1278 nd = ndarray(scalar, shape=(), format=fmt)
1279 self.verify(nd, obj=None,
1290 nd = ndarray(items, shape=[nitems], format=fmt, flags=flags)
1291 self.verify(nd, obj=None,
1310 nd = ndarray(items, shape=shape, strides=strides,
1312 self.verify(nd, obj=None,
1320 nd = ndarray(ex, getbuf=PyBUF_F_CONTIGUOUS|PyBUF_FORMAT)
1321 self.assertEqual(nd.tolist(), farray(items, (3, 4)))
1337 nd = ndarray(items, shape=shape, format=fmt, flags=flags)
1341 self.verify(nd, obj=None,
1349 nd = ndarray(ex, getbuf=PyBUF_CONTIG_RO|PyBUF_FORMAT)
1350 self.assertTrue(nd.strides == ())
1351 mv = nd.memoryview_from_buffer()
1358 nd = ndarray(items, shape=shape, format=fmt,
1363 self.verify(nd, obj=None,
1370 nd = ndarray([1], shape=[1])
1371 self.assertRaises(TypeError, nd.__setitem__, 1, 8)
1372 mv = memoryview(nd)
1373 self.assertEqual(mv, nd)
1377 nd = ndarray([1], shape=[1], flags=ND_WRITABLE)
1378 self.assertRaises(TypeError, nd.__delitem__, 1)
1379 mv = memoryview(nd)
1380 self.assertEqual(mv, nd)
1384 nd = ndarray([1], shape=[1], flags=ND_WRITABLE)
1385 self.assertRaises(OverflowError, nd.__getitem__, 1<<64)
1386 self.assertRaises(OverflowError, nd.__setitem__, 1<<64, 8)
1387 mv = memoryview(nd)
1388 self.assertEqual(mv, nd)
1394 nd = ndarray(items, shape=[len(items)], format="B", flags=ND_WRITABLE)
1395 self.assertRaises(struct.error, nd.__setitem__, 2, 300)
1396 self.assertRaises(ValueError, nd.__setitem__, 1, (100, 200))
1397 mv = memoryview(nd)
1398 self.assertEqual(mv, nd)
1403 nd = ndarray(items, shape=[len(items)], format="LQ", flags=ND_WRITABLE)
1404 self.assertRaises(ValueError, nd.__setitem__, 2, 300)
1405 self.assertRaises(struct.error, nd.__setitem__, 1, (b'\x001', 200))
1409 nd = ndarray(1, shape=(), flags=ND_WRITABLE)
1410 mv = memoryview(nd)
1411 self.assertEqual(mv, nd)
1413 x = nd[()]; self.assertEqual(x, 1)
1414 x = nd[...]; self.assertEqual(x.tolist(), nd.tolist())
1417 x = mv[...]; self.assertEqual(x.tolist(), nd.tolist())
1419 self.assertRaises(TypeError, nd.__getitem__, 0)
1421 self.assertRaises(TypeError, nd.__setitem__, 0, 8)
1424 self.assertEqual(nd.tolist(), 1)
1427 nd[()] = 9; self.assertEqual(nd.tolist(), 9)
1430 nd[...] = 5; self.assertEqual(nd.tolist(), 5)
1435 nd = ndarray(ex, getbuf=PyBUF_CONTIG)
1438 self.assertRaises(BufferError, nd.__getitem__, 1)
1440 self.assertRaises(BufferError, nd.__getitem__, slice(3,5,1))
1445 nd = ndarray(items, shape=[5], format=fmt)
1447 self.assertEqual(nd[i], items[i])
1449 self.assertRaises(IndexError, nd.__getitem__, -6)
1450 self.assertRaises(IndexError, nd.__getitem__, 5)
1453 mv = memoryview(nd)
1454 self.assertEqual(mv, nd)
1464 nd = ndarray(ex, getbuf=PyBUF_CONTIG|PyBUF_FORMAT)
1467 self.assertEqual(nd[i], items[i])
1470 mv = nd.memoryview_from_buffer()
1471 self.assertIs(mv.__eq__(nd), NotImplemented)
1478 nd = ndarray(ex, getbuf=PyBUF_CONTIG_RO)
1480 self.assertEqual(nd[i], items[i])
1485 nd = ndarray(ex, getbuf=PyBUF_SIMPLE)
1488 self.assertEqual(nd[i], items[i])
1493 nd = ndarray(items, shape=[5], format=fmt, flags=ND_WRITABLE)
1496 nd[i] = single_item
1497 self.assertEqual(nd.tolist(), items)
1499 self.assertRaises(IndexError, nd.__setitem__, -6, single_item)
1500 self.assertRaises(IndexError, nd.__setitem__, 5, single_item)
1505 nd = ndarray(items, shape=[5], format=fmt, flags=ND_WRITABLE)
1506 mv = memoryview(nd)
1507 self.assertEqual(mv, nd)
1519 nd = ndarray(items, shape=[5], format=fmt, flags=ND_WRITABLE)
1522 nd[i] = nd[i+1]
1523 self.assertEqual(nd.tolist(), items)
1528 nd = ndarray(items, shape=[5], format=fmt, flags=ND_WRITABLE)
1529 mv = memoryview(nd)
1530 self.assertEqual(mv, nd)
1545 nd = ndarray(items, shape=shape, format=fmt, flags=flags)
1549 self.assertEqual(lst[i], nd[i].tolist())
1551 self.assertEqual(lst[i][j], nd[i][j].tolist())
1553 self.assertEqual(lst[i][j][k], nd[i][j][k])
1556 nd = ndarray(items, shape=shape, format=fmt,
1561 self.assertEqual(lst[i], nd[i].tolist())
1563 self.assertEqual(lst[i][j], nd[i][j].tolist())
1565 self.assertEqual(lst[i][j][k], nd[i][j][k])
1568 nd = ndarray(1, shape=())
1570 mv = memoryview(nd)
1571 self.assertEqual(mv, nd)
1575 nd = ndarray(items, shape=[5], format=fmt)
1576 for i, v in enumerate(nd):
1578 self.assertTrue(v in nd)
1581 mv = memoryview(nd)
1602 nd = ndarray(items, shape=[8], format="L", flags=ND_WRITABLE)
1603 mv = memoryview(nd)
1604 self.assertRaises(ValueError, nd.__getitem__, slice(0,1,0))
1607 nd = ndarray(items, shape=[2,4], format="L", flags=ND_WRITABLE)
1608 mv = memoryview(nd)
1610 self.assertRaises(ValueError, nd.__getitem__,
1612 self.assertRaises(ValueError, nd.__getitem__,
1614 self.assertRaises(TypeError, nd.__getitem__, "@%$")
1615 self.assertRaises(TypeError, nd.__getitem__, ("@%$", slice(0,1,1)))
1616 self.assertRaises(TypeError, nd.__getitem__, (slice(0,1,1), {}))
1705 nd = ndarray(items, shape=shape, format=fmt, flags=flags)
1718 ndsliced = nd[slices]
1736 nd = ndarray(items, shape=shape, format=fmt)
1737 nd.add_suboffsets()
1753 ndsliced = nd[slices]
1769 nd = ndarray(items, shape=[5], format=fmt, flags=f)
1786 nd[lslice] = nd[rslice]
1793 self.assertEqual(nd.tolist(), lst)
1809 self.assertEqual(mv, nd)
1812 itemsize=nd.itemsize, fmt=fmt, readonly=0,
1813 ndim=nd.ndim, shape=nd.shape, strides=nd.strides,
1814 lst=nd.tolist())
1828 nd = ndarray(items, shape=shape, format=fmt,
1840 nd[lslices] = nd[rslices]
1847 self.assertEqual(nd.tolist(), result)
1983 nd = ndarray(items, shape=[3,4], flags=ND_PIL)
1984 ex = ndarray(nd)
1987 self.assertIs(ex.obj, nd)
1996 nd = ndarray([1,2,3], shape=[0], flags=flags)
1997 mv = memoryview(nd)
1998 self.assertEqual(mv, nd)
1999 self.assertEqual(nd.tolist(), [])
2002 nd = ndarray([1,2,3], shape=[0,3,3], flags=flags)
2003 self.assertEqual(nd.tolist(), [])
2005 nd = ndarray([1,2,3], shape=[3,0,3], flags=flags)
2006 self.assertEqual(nd.tolist(), [[], [], []])
2008 nd = ndarray([1,2,3], shape=[3,3,0], flags=flags)
2009 self.assertEqual(nd.tolist(),
2015 nd = ndarray([1], shape=[5], strides=[0], flags=flags)
2016 mv = memoryview(nd)
2017 self.assertEqual(mv, nd)
2018 self.assertEqual(nd.tolist(), [1, 1, 1, 1, 1])
2022 nd = ndarray(list(range(20)), shape=[3], offset=7)
2023 self.assertEqual(nd.offset, 7)
2024 self.assertEqual(nd.tolist(), [7,8,9])
2028 nd = ndarray(list(range(3)), shape=[3], flags=flags)
2029 m = nd.memoryview_from_buffer()
2030 self.assertEqual(m, nd)
2034 nd = ndarray(list(range(3)), shape=[3], flags=flags)
2036 self.assertEqual(nd[i], get_pointer(nd, [i]))
2041 nd = ndarray(ex, getbuf=PyBUF_ND|PyBUF_FORMAT)
2042 self.assertEqual(nd.tolist(), ex.tolist())
2062 nd = ndarray(a)
2063 self.assertRaises(ValueError, hash, nd)
2068 nd = ndarray(list(range(12)), shape=[12])
2069 self.assertEqual(hash(nd), hash(b))
2072 nd = ndarray(list(range(12)), shape=[3,4])
2073 self.assertEqual(hash(nd), hash(b))
2075 nd = ndarray(list(range(12)), shape=[3,2,2])
2076 self.assertEqual(hash(nd), hash(b))
2080 nd = ndarray(list(range(12)), shape=[3,4], flags=ND_FORTRAN)
2081 self.assertEqual(hash(nd), hash(b))
2084 nd = ndarray(list(range(12)), shape=[2,3,2], flags=ND_FORTRAN)
2085 self.assertEqual(hash(nd), hash(b))
2089 nd = ndarray(list(range(12)), shape=[2,2,3], flags=ND_PIL)
2090 self.assertEqual(hash(nd), hash(b))
2093 nd = ndarray(list(range(12)), shape=[2,2,3], format='L')
2094 self.assertEqual(hash(nd), hash(nd.tobytes()))
2115 nd = ndarray(9, shape=(), format="L", flags=ND_WRITABLE)
2118 b = py_buffer_to_contiguous(nd, order, request)
2119 self.assertEqual(b, nd.tobytes())
2122 nd = ndarray([1], shape=[0], format="L", flags=ND_WRITABLE)
2125 b = py_buffer_to_contiguous(nd, order, request)
2128 nd = ndarray(list(range(8)), shape=[2, 0, 7], format="L",
2132 b = py_buffer_to_contiguous(nd, order, request)
2140 nd = ndarray([1], shape=[1], format="h", flags=f|ND_WRITABLE)
2141 ndbytes = nd.tobytes()
2144 b = py_buffer_to_contiguous(nd, order, request)
2147 nd = ndarray([1, 2, 3], shape=[3], format="b", flags=f|ND_WRITABLE)
2148 ndbytes = nd.tobytes()
2151 b = py_buffer_to_contiguous(nd, order, request)
2155 nd = ndarray([1, 2, 3], shape=[2], strides=[2], flags=ND_WRITABLE)
2156 ndbytes = nd.tobytes()
2159 b = py_buffer_to_contiguous(nd, order, request)
2162 nd = nd[::-1]
2163 ndbytes = nd.tobytes()
2167 b = py_buffer_to_contiguous(nd, order, request)
2238 nd = ndarray(lst, shape=[3, 4], flags=f|ND_WRITABLE)
2250 expected = nd.tobytes()
2253 b = py_buffer_to_contiguous(nd, 'C', request)
2262 self.assertEqual(memoryview(y), memoryview(nd))
2277 b = py_buffer_to_contiguous(nd, 'F', request)
2285 self.assertEqual(memoryview(y), memoryview(nd))
2295 expected = nd.tobytes()
2299 b = py_buffer_to_contiguous(nd, 'A', request)
2309 self.assertEqual(memoryview(y), memoryview(nd))
2315 nd = ndarray(list(range(12)), shape=[3, 4], flags=ND_WRITABLE|ND_PIL)
2318 b = py_buffer_to_contiguous(nd, 'C', PyBUF_FULL_RO)
2319 self.assertEqual(b, nd.tobytes())
2321 self.assertEqual(memoryview(y), memoryview(nd))
2324 b = py_buffer_to_contiguous(nd, 'F', PyBUF_FULL_RO)
2328 self.assertEqual(memoryview(y), memoryview(nd))
2331 b = py_buffer_to_contiguous(nd, 'A', PyBUF_FULL_RO)
2332 self.assertEqual(b, nd.tobytes())
2334 self.assertEqual(memoryview(y), memoryview(nd))
2366 nd = ndarray(ex, getbuf=PyBUF_CONTIG_RO|PyBUF_FORMAT)
2367 self.assertEqual(nd.strides, ())
2368 m = nd.memoryview_from_buffer()
2375 nd = ndarray(ex, getbuf=PyBUF_SIMPLE)
2376 self.assertEqual(nd.format, '')
2377 self.assertEqual(nd.shape, ())
2378 self.assertEqual(nd.strides, ())
2379 m = nd.memoryview_from_buffer()
2440 nd = ndarray(ex, getbuf=PyBUF_SIMPLE)
2441 self.assertRaises(BufferError, memoryview, nd)
2442 nd = ndarray(ex, getbuf=PyBUF_CONTIG_RO|PyBUF_FORMAT)
2443 self.assertRaises(BufferError, memoryview, nd)
2446 nd = ndarray([1]*128, shape=[1]*128, format='L')
2447 self.assertRaises(ValueError, memoryview, nd)
2448 self.assertRaises(ValueError, nd.memoryview_from_buffer)
2449 self.assertRaises(ValueError, get_contiguous, nd, PyBUF_READ, 'C')
2450 self.assertRaises(ValueError, get_contiguous, nd, PyBUF_READ, 'F')
2451 self.assertRaises(ValueError, get_contiguous, nd[::-1], PyBUF_READ, 'C')
2512 nd = ndarray(items, shape=[10], format=fmt, flags=ND_WRITABLE)
2515 struct.pack_into(fmt, nd, 0, item)
2517 self.assertEqual(m[0], nd[0])
2526 struct.pack_into(fmt, nd, itemsize, v)
2540 self.assertEqual(m[1], nd[1])
2632 nd = ndarray(list(range(128)), shape=[128], format='I')
2633 m = memoryview(nd)
2647 nd = ndarray(list(range(128)), shape=[128], format='I')
2648 m1 = memoryview(nd)
2649 nd = ndarray(list(range(128)), shape=[128], format='B')
2650 m2 = memoryview(nd)
2752 nd = ndarray(titems, shape=tshape, format=tfmt)
2756 strides = nd.strides
2757 lst = nd.tolist()
2971 nd = ndarray([b'x'], shape=[1], format='c', flags=ND_WRITABLE)
2972 m = memoryview(nd)
3176 nd = ndarray([(0, 0)], shape=[1], format='l x d x', flags=ND_WRITABLE)
3177 nd[0] = (-1, float('nan'))
3178 self.assertNotEqual(memoryview(nd), nd)
3226 nd = ndarray(list(range(12)), shape=[12], flags=ND_WRITABLE|ND_PIL)
3230 self.assertEqual(m, nd)
3232 self.assertNotEqual(m, nd)
3393 nd = ndarray(items, shape=[n], format=fmt, flags=flags)
3394 m = memoryview(nd)
3395 self.assertEqual(m, nd)
3397 nd = nd[::-3]
3398 m = memoryview(nd)
3399 self.assertEqual(m, nd)
3406 nd = ndarray(items, shape=[n], format=fmt, flags=flags)
3407 m = memoryview(nd)
3408 self.assertEqual(m, nd)
3410 nd = nd[::-3]
3411 m = memoryview(nd)
3412 self.assertEqual(m, nd)
3901 nd = ndarray(t, shape=[5], format='@h')
3902 m = memoryview(nd)
3903 self.assertEqual(m, nd)
3904 self.assertEqual(m.tobytes(), nd.tobytes())
3906 nd = ndarray([t], shape=[1], format='>hQiLl')
3907 m = memoryview(nd)
3908 self.assertEqual(m, nd)
3909 self.assertEqual(m.tobytes(), nd.tobytes())
3911 nd = ndarray([t for _ in range(12)], shape=[2,2,3], format='=hQiLl')
3912 m = memoryview(nd)
3913 self.assertEqual(m, nd)
3914 self.assertEqual(m.tobytes(), nd.tobytes())
3916 nd = ndarray([t for _ in range(120)], shape=[5,2,2,3,2],
3918 m = memoryview(nd)
3919 self.assertEqual(m, nd)
3920 self.assertEqual(m.tobytes(), nd.tobytes())
3941 nd = ndarray([1, 2, 3], shape=[2], strides=[2])
3942 self.assertRaises(BufferError, get_contiguous, nd, PyBUF_WRITE, 'A')
3945 nd = ndarray(9, shape=(), format="L")
3947 m = get_contiguous(nd, PyBUF_READ, order)
3948 self.assertEqual(m, nd)
3952 nd = ndarray(9, shape=(), format="L", flags=ND_WRITABLE)
3954 m = get_contiguous(nd, PyBUF_READ, order)
3955 self.assertEqual(m, nd)
3960 nd[()] = 9
3961 m = get_contiguous(nd, PyBUF_WRITE, order)
3962 self.assertEqual(m, nd)
3967 self.assertEqual(nd[()], 10)
3970 nd = ndarray([1], shape=[0], format="L", flags=ND_WRITABLE)
3972 m = get_contiguous(nd, PyBUF_READ, order)
3974 self.assertEqual(m, nd)
3977 nd = ndarray(list(range(8)), shape=[2, 0, 7], format="L",
3980 m = get_contiguous(nd, PyBUF_READ, order)
3984 nd = ndarray([1], shape=[1], format="h", flags=ND_WRITABLE)
3986 m = get_contiguous(nd, PyBUF_WRITE, order)
3987 self.assertEqual(m, nd)
3988 self.assertEqual(m.tolist(), nd.tolist())
3990 nd = ndarray([1, 2, 3], shape=[3], format="b", flags=ND_WRITABLE)
3992 m = get_contiguous(nd, PyBUF_WRITE, order)
3993 self.assertEqual(m, nd)
3994 self.assertEqual(m.tolist(), nd.tolist())
3997 nd = ndarray([1, 2, 3], shape=[2], strides=[2], flags=ND_WRITABLE)
3999 m = get_contiguous(nd, PyBUF_READ, order)
4000 self.assertEqual(m, nd)
4001 self.assertEqual(m.tolist(), nd.tolist())
4004 self.assertEqual(nd[1], 3)
4006 nd = nd[::-1]
4008 m = get_contiguous(nd, PyBUF_READ, order)
4009 self.assertEqual(m, nd)
4010 self.assertEqual(m.tolist(), nd.tolist())
4013 self.assertEqual(nd[1], 1)
4016 nd = ndarray(list(range(12)), shape=[3, 4], flags=ND_WRITABLE)
4018 m = get_contiguous(nd, PyBUF_WRITE, order)
4019 self.assertEqual(ndarray(m).tolist(), nd.tolist())
4021 self.assertRaises(BufferError, get_contiguous, nd, PyBUF_WRITE, 'F')
4022 m = get_contiguous(nd, PyBUF_READ, order)
4023 self.assertEqual(ndarray(m).tolist(), nd.tolist())
4025 nd = ndarray(list(range(12)), shape=[3, 4],
4028 m = get_contiguous(nd, PyBUF_WRITE, order)
4029 self.assertEqual(ndarray(m).tolist(), nd.tolist())
4031 self.assertRaises(BufferError, get_contiguous, nd, PyBUF_WRITE, 'C')
4032 m = get_contiguous(nd, PyBUF_READ, order)
4033 self.assertEqual(ndarray(m).tolist(), nd.tolist())
4036 nd = ndarray(list(range(12)), shape=[3, 4], flags=ND_WRITABLE|ND_PIL)
4038 self.assertRaises(BufferError, get_contiguous, nd, PyBUF_WRITE,
4040 m = get_contiguous(nd, PyBUF_READ, order)
4041 self.assertEqual(ndarray(m).tolist(), nd.tolist())
4044 nd = ndarray([1,2,3,4,5], shape=[3], strides=[2])
4045 m = get_contiguous(nd, PyBUF_READ, 'C')
4061 nd = ndarray(list(range(12)), shape=[2,3,2], format="L")
4062 m = memoryview(nd)
4095 nd = ndarray(list(range(30)), shape=[3,2,5], flags=ND_FORTRAN)
4096 m = memoryview(nd)
4097 self.assertEqual(hash(m), hash(nd))
4100 nd = ndarray(list(range(30)), shape=[3,2,5])
4101 x = nd[::2, ::, ::-1]
4106 nd = ndarray(list(range(30)), shape=[2,5,3], flags=ND_PIL)
4107 x = nd[::2, ::, ::-1]
4122 nd = ndarray(list(range(12)), shape=[2,2,3], format='L')
4123 m = memoryview(nd)
4126 nd = ndarray(list(range(-6, 6)), shape=[2,2,3], format='h')
4127 m = memoryview(nd)
4130 nd = ndarray(list(range(12)), shape=[2,2,3], format='= L')
4131 m = memoryview(nd)
4134 nd = ndarray(list(range(-6, 6)), shape=[2,2,3], format='< h')
4135 m = memoryview(nd)
4143 nd = ndarray(m) # re-exporter
4145 del nd
4161 nd = ndarray(m2) # re-exporter
4164 del nd
4179 nd = ndarray([1,2,3], shape=[3], flags=ND_VAREXPORT)
4180 m1 = memoryview(nd)
4182 nd.push([4,5,6,7,8], shape=[5]) # mutate nd
4183 m2 = memoryview(nd)
4190 self.assertEqual(y.tolist(), nd.tolist())
4194 nd.pop() # pop the current view
4195 self.assertEqual(x.tolist(), nd.tolist())
4197 del nd
4268 nd = ndarray([1.0 * x for x in range(12)], shape=[12], format='d')
4271 for x in (nd, a):
4387 nd = ndarray([1,2,3], [3], flags=ND_GETBUF_FAIL|ND_GETBUF_UNDEFINED)
4388 self.assertRaises(BufferError, memoryview, nd)