• Home
  • Raw
  • Download

Lines Matching refs:newp

230         x = newp(BArray, None)
279 py.test.raises(TypeError, newp, BInt)
280 py.test.raises(TypeError, newp, BInt, None)
282 p = newp(BPtr)
284 p = newp(BPtr, None)
286 p = newp(BPtr, 5000)
292 e = py.test.raises(TypeError, newp, new_array_type(BPtr, None), None)
308 p = newp(BPtrPtr, None)
314 p = newp(BPtr, None)
316 p = newp(BPtr, 5000)
323 py.test.raises(TypeError, newp, BFloat, None)
325 p = newp(BPtr, None)
327 p = newp(BPtr, 1.25)
329 p = newp(BPtr, 1.1)
337 py.test.raises(TypeError, newp, new_pointer_type(p), 4.2)
346 assert newp(pp, min)[0] == min
347 assert newp(pp, max)[0] == max
348 py.test.raises(OverflowError, newp, pp, min - 2 ** 32)
349 py.test.raises(OverflowError, newp, pp, min - 2 ** 64)
350 py.test.raises(OverflowError, newp, pp, max + 2 ** 32)
351 py.test.raises(OverflowError, newp, pp, max + 2 ** 64)
352 py.test.raises(OverflowError, newp, pp, min - 1)
353 py.test.raises(OverflowError, newp, pp, max + 1)
354 py.test.raises(OverflowError, newp, pp, min - 1 - 2 ** 32)
355 py.test.raises(OverflowError, newp, pp, min - 1 - 2 ** 64)
356 py.test.raises(OverflowError, newp, pp, max + 1)
357 py.test.raises(OverflowError, newp, pp, max + 1 + 2 ** 32)
358 py.test.raises(OverflowError, newp, pp, max + 1 + 2 ** 64)
359 py.test.raises(TypeError, newp, pp, 1.0)
365 assert newp(pp, 0)[0] == 0
366 assert newp(pp, max)[0] == max
367 py.test.raises(OverflowError, newp, pp, -1)
368 py.test.raises(OverflowError, newp, pp, max + 1)
372 py.test.raises(TypeError, newp, BChar, None)
374 p = newp(BPtr, None)
376 p = newp(BPtr, b'A')
378 py.test.raises(TypeError, newp, BPtr, 65)
379 py.test.raises(TypeError, newp, BPtr, b"foo")
380 py.test.raises(TypeError, newp, BPtr, u+"foo")
386 e = py.test.raises(TypeError, newp, new_array_type(BPtr, None), 12.3)
396 q = newp(BIntPtr, 42)
398 p = newp(BIntPtrPtr, None)
410 p = newp(BIntPtrPtr, q)
457 x = newp(BArray, None)
465 x = newp(BArray, None)
534 a = newp(p1, None)
553 py.test.raises(TypeError, newp, p1, None)
554 py.test.raises(ValueError, newp, p1, -42)
555 a = newp(p1, 42)
569 a = newp(p1, list(range(42)))
571 a = newp(p1, tuple(range(142)))
577 a = newp(p1, list(range(100, 142)))
582 a = newp(p2, tuple(range(100, 142)))
591 a = newp(p2, [list(range(n, n+5)) for n in [100, 200, 300]])
605 a = newp(BArray, None)
611 q = newp(BPtr, None)
659 n = newp(p1, cast(p, -42))
664 n = newp(p1, cast(p, 42))
669 n = newp(p1, cast(p, 42.5))
674 n = newp(p1, cast(p, "A"))
680 a = newp(BIntA, [40, 41, 42, 43, 44])
789 p = newp(BStructPtr, None)
815 pp = newp(new_pointer_type(BStructPtr), p)
826 p = newp(new_pointer_type(BUnion), [-42])
830 p = newp(new_pointer_type(BUnion), {'a2': bigval})
833 py.test.raises(OverflowError, newp, new_pointer_type(BUnion),
835 p = newp(new_pointer_type(BUnion), [])
844 p = newp(BStructPtr, None)
860 s = newp(BStructPtr, [123, 456])
867 s = newp(BStructPtr, {'a2': 41122, 'a3': -123})
873 py.test.raises(KeyError, newp, BStructPtr, {'foobar': 0})
875 p = newp(BIntPtr, 14141)
876 s = newp(BStructPtr, [12, 34, 56, p])
880 s = newp(BStructPtr, [12, 34, 56, cast(BVoidP, 0)])
884 py.test.raises(TypeError, newp, BStructPtr, [12, 34, 56, None])
891 s = newp(new_pointer_type(BStruct), [[20, 24, 27, 29, 30]])
1013 x = newp(BIntPtr, 42)
1030 x = newp(BIntArray, [242])
1051 x = newp(BStructPtr, {'a1': b'A', 'a2': -4042})
1064 x = newp(BStructPtr, {'a1': b'A', 'a2': -4042})
1095 p1 = newp(BStructP, {'a': list(range(100, 110))})
1096 p2 = newp(BStructP, {'a': list(range(1000, 1100, 10))})
1214 x = newp(BCharA, 42)
1216 x = newp(BCharA, b"foobar")
1226 input = newp(new_array_type(BCharP, None), b"foobar")
1454 p = newp(BStructPtr, [-2, -4])
1466 return newp(BStructPtr, [-n, -3*n])[0]
1487 p = newp(BStructPtr, [-2, 44.444])
1500 return newp(BStructPtr, [-n, 1E-42])[0]
1530 p = newp(BStructPtr, list(range(13, 3, -1)))
1549 return newp(BStructPtr, list(range(13, 3, -1)))[0]
1630 p = newp(BStructPtr, [-20])
1632 p = newp(BStructPtr, [12])
1634 e = py.test.raises(TypeError, newp, BStructPtr, [None])
1765 p = newp(new_pointer_type(BStruct), None)
1793 p = newp(new_pointer_type(BStruct), [-1])
1795 p = newp(new_pointer_type(BStruct), {'a1': -1})
1800 p = newp(new_pointer_type(BUnion), [-1])
1808 _weakref.ref(newp(BPtr, 42)),
1811 _weakref.ref(buffer(newp(BPtr, 42))),
1838 a = newp(BArray2, [b"abc", b"de", b"ghij"])
1856 py.test.raises(TypeError, newp, new_pointer_type(new_void_type()), None)
1861 py.test.raises(IndexError, newp, BArray, tuple(b'123456'))
1862 py.test.raises(IndexError, newp, BArray, list(b'123456'))
1863 py.test.raises(IndexError, newp, BArray, b'123456')
1866 py.test.raises(TypeError, newp, new_pointer_type(BStruct), b'')
1867 py.test.raises(ValueError, newp, new_pointer_type(BStruct), [b'1'])
1873 py.test.raises(TypeError, newp, BArray, 12.34)
1875 py.test.raises(TypeError, newp, BArray, 12.34)
1877 py.test.raises(TypeError, cast, BFloat, newp(BArray, None))
1881 py.test.raises(OverflowError, newp, new_pointer_type(BUInt), -1)
1882 py.test.raises(OverflowError, newp, new_pointer_type(BUInt), 2**32)
1889 p = newp(new_pointer_type(BInt), cast(BInt, 42))
1893 p = newp(new_pointer_type(BUInt), cast(BUInt, 42))
1897 p = newp(new_pointer_type(BChar), cast(BChar, '!'))
1901 p = newp(new_pointer_type(BFloat), cast(BFloat, 12.25))
1907 s1 = newp(BStructPtr, [42])
1908 p1 = newp(new_pointer_type(BStructPtr), s1)
1912 a1 = newp(BArray, [1, 2, 3, 4])
1913 py.test.raises(TypeError, newp, BArray, a1)
1915 a1 = newp(BArray6, [10, 20, 30])
1916 a2 = newp(BArray6, a1)
1919 s1 = newp(BStructPtr, [42])
1920 s2 = newp(BStructPtr, s1[0])
1926 u1 = newp(BUnionPtr, [42])
1927 u2 = newp(BUnionPtr, u1[0])
1932 p2 = newp(new_pointer_type(BFunc), p1)
1941 a = newp(BArray, b"hello")
1946 assert string(newp(new_array_type(BCharP, 4), b"abcd")) == b"abcd"
1957 a = newp(BArray, [65, 66, 67])
1964 a = newp(BArray, [65, 66, 67])
1979 a = newp(BArray, [u+'A', u+'B', u+'C'])
1991 a = newp(BArray, [65, 66, 67])
1999 py.test.raises(TypeError, newp, new_pointer_type(BCharP), x)
2008 p = newp(BStructPtr, None)
2130 newp(BStructPtr, [cast(BFunc, 0)])
2131 newp(BStructPtr, [cast(BCharP, 0)])
2132 py.test.raises(TypeError, newp, BStructPtr, [cast(BIntP, 0)])
2133 py.test.raises(TypeError, newp, BStructPtr, [cast(BFunc2, 0)])
2181 s = newp(BStructPtr)
2202 a = newp(BWCharArray, u+'hello \u1234 world')
2215 a = newp(BWCharArray, u1)
2255 a = newp(BWCharArray, u+'hello - world')
2261 s = newp(BStructPtr, [u+'\u1234', p])
2297 py.test.raises(TypeError, newp, BChar16A, [x])
2299 py.test.raises(TypeError, newp, BChar32A, [x])
2301 a = newp(BChar16A, u+'\U00012345')
2303 a = newp(BChar32A, u+'\U00012345')
2315 p = newp(BStructPtr)
2334 p = newp(BStructPtr)
2335 pp = newp(BStructPtrPtr)
2343 p = newp(BArray, 7)
2348 p = newp(BArray, None)
2363 p = newp(BArray, 7)
2373 p = newp(BIntP, 123)
2393 s = newp(BIntP, 125)
2406 s = newp(new_pointer_type(BShort), 100)
2413 c = newp(BCharArray, b"hi there")
2534 py.test.raises(TypeError, newp, BDoubleP, "foobar")
2539 x = newp(BCharP)
2546 x = newp(new_pointer_type(BStruct))
2560 py.test.raises(TypeError, newp, BStructP, None)
2561 x = newp(BStructP, 5)
2568 py.test.raises(TypeError, newp, BStructP, [123])
2569 x = newp(BStructP, [123, 5])
2574 x = newp(BStructP, {'a2': 5})
2579 x = newp(BStructP, [123, (4, 5)])
2584 x = newp(BStructP, {'a2': (4, 5)})
2595 x = newp(BIntPtr, cast(BInt, 42))
2597 x = newp(BIntPtr, cast(BLongLong, 42))
2599 x = newp(BIntPtr, cast(BULongLong, 42))
2601 x = newp(BULongLongPtr, cast(BInt, 42))
2603 py.test.raises(OverflowError, newp, BULongLongPtr, cast(BInt, -42))
2621 x = newp(BFloatPtr, cast(BDouble, 12.5))
2632 a = newp(BLongDoubleArray, 1)
2639 b = newp(BLongDoubleArray, [1.23])
2660 c = newp(BLongDoubleArray, [lstart])
2672 p = newp(BStructPtr, None)
2755 chrref = newp(BCharP, None)
2769 py.test.raises(TypeError, newp, BIntP, cast(BFloat, 0.0))
2770 py.test.raises(TypeError, newp, BUIntP, cast(BFloat, 0.0))
2786 assert newp(BBoolP, False)[0] == 0
2787 assert newp(BBoolP, True)[0] == 1
2788 assert newp(BBoolP, 0)[0] == 0
2789 assert newp(BBoolP, 1)[0] == 1
2790 py.test.raises(TypeError, newp, BBoolP, 1.0)
2791 py.test.raises(TypeError, newp, BBoolP, '\x00')
2792 py.test.raises(OverflowError, newp, BBoolP, 2)
2793 py.test.raises(OverflowError, newp, BBoolP, -1)
2795 p = newp(BCharP, b'\x01')
2798 p = newp(BCharP, b'\x00')
2806 p = newp(BBoolA, b'\x01\x00')
2815 p = newp(BCharP, b'X')
2818 py.test.raises(TypeError, newp, BBoolP, b'\x00')
2819 assert newp(BBoolP, 0)[0] is False
2820 assert newp(BBoolP, 1)[0] is True
2821 py.test.raises(OverflowError, newp, BBoolP, 2)
2822 py.test.raises(OverflowError, newp, BBoolP, -1)
2823 py.test.raises(ValueError, newp, BBoolA, b'\x00\x01\x02')
2824 py.test.raises(OverflowError, newp, BBoolA, [0, 1, 2])
2825 py.test.raises(TypeError, string, newp(BBoolP, 1))
2826 py.test.raises(TypeError, string, newp(BBoolA, [1]))
2877 p = newp(BStructPtr)
2898 e = newp(BCharA, 50)
2905 p = newp(BCharArray, b"foo")
2911 p = newp(BUCharArray, b"fo\xff")
2917 p = newp(BSCharArray, b"fo\xff")
2924 py.test.raises(TypeError, newp, BCharArray, bytearray(b"foo"))
2925 p = newp(BCharArray, 5)
2935 p = newp(BByteArray, 5)
2972 p = newp(new_array_type(BCharP, 100), None)
3089 py.test.raises(TypeError, newp, BCharArray, u+'foobar')
3096 c = newp(BCharArray, str2bytes("hi there %d" % i))
3106 c = newp(BIntArray, 5)
3123 c = newp(BIntArray, 5)
3133 c = newp(BIntArray, 5)
3143 c = newp(BIntArray, 5)
3160 c = newp(BIntArray, 5)
3176 c = newp(BIntArray, 5)
3177 d = newp(BIntArray, [10, 20, 30])
3183 d = newp(BShortArray, [40, 50])
3259 p = newp(new_pointer_type(BStruct), None)
3371 p = newp(new_pointer_type(BStruct))
3378 p = newp(new_pointer_type(BStruct), [100])
3388 p = newp(new_pointer_type(BStruct), [100, [200, i, 400]])
3390 p = newp(new_pointer_type(BStruct), [100, 3])
3440 p = newp(new_pointer_type(BStruct2), {'n': 42})
3444 py.test.raises(TypeError, newp, new_pointer_type(BStruct), [100, None])
3448 py.test.raises(TypeError, newp, new_pointer_type(BStruct4), [None])
3449 py.test.raises(TypeError, newp, new_pointer_type(BStruct4), [4])
3450 p = newp(new_pointer_type(BStruct4), [[10, 20, 30]])
3463 p = newp(new_pointer_type(BStruct), [[10, 20], 30])
3468 p = newp(new_pointer_type(BStruct), {'x': [40], 'y': 50})
3473 p = newp(new_pointer_type(BStruct), {'y': 60})
3483 p = newp(new_pointer_type(BStruct), [[10, 20, 30, 40, 50, 60, 70]])
3512 p = newp(new_pointer_type(BStruct), {'z': 3})
3514 q = newp(new_pointer_type(BStruct), {'z': size_of_int()})
3525 p = newp(BArray, b"foobar")
3535 p = newp(BArray, u+"foobar")
3559 p = newp(BArray, None)
3761 bytestring = buffer(newp(BIntA, lst))[:] + b'XYZ'
3819 p = newp(ShortA, [-1234, -2345, -3456, -4567, -5678])
3825 memmove(p + 4, newp(CharA, b"\x71\x72"), 2)
3836 p = newp(ShortA, 5)
3862 p = newp(SignedCharA, 5)
3877 p = newp(SignedCharA, 5)
3905 pp1 = newp(BStruct1PtrPtr)
3906 pp2 = newp(BStruct2PtrPtr)
3907 pp3 = newp(BStruct3PtrPtr)
3939 p = newp(BArray, b"abc\x00def")
3947 p = newp(BArray, u"abc\x00def")
3965 p = newp(BArray, samples)
3981 lst = unpack(newp(BArray, [random_ptr, other_ptr]), 2)
3986 lst = unpack(newp(new_array_type(BFuncPtr, None), 2), 2)
3997 array_of_structs = newp(new_array_type(BStructPtr, None), [[4,5], [6,7]])
4012 p = newp(new_array_type(new_pointer_type(BInt), None), 5)
4020 p = newp(new_pointer_type(BStruct), None)
4023 pp = newp(new_pointer_type(new_pointer_type(BStruct)), p)
4042 newp(new_pointer_type(BIntP), z1) # warn
4044 newp(new_pointer_type(BVoidP), z1) # fine
4046 newp(new_pointer_type(BCharP), z2) # warn
4048 newp(new_pointer_type(BVoidP), z2) # fine
4050 newp(new_pointer_type(BCharP), z3) # fine
4052 newp(new_pointer_type(BIntP), z3) # fine
4054 newp(new_pointer_type(BCharP), z4) # fine (ignore signedness here)
4056 newp(new_pointer_type(BUCharP), z1) # fine (ignore signedness here)
4058 newp(new_pointer_type(BUCharP), z3) # fine
4152 p = newp(BIntP)
4162 pstruct = newp(BStructP)
4170 with newp(BIntP) as p:
4184 pstruct = newp(BStructP)
4196 intp1 = newp(BIntP, 12345)
4209 intp1 = newp(BIntP, 12345)