Debian Codegraph @

extra_tests/ctypes_tests/test_base.py

raw symbols SCIP
1 import pytest
2 from ctypes import *
3
4 pytestmark = pytest.mark.pypy_only
5
6 def test_pointer():
7 p = pointer(pointer(c_int(2)))
8 x = p[0]
9 assert x._base is p
10
11 def test_structure():
12 class X(Structure):
13 _fields_ = [('x', POINTER(c_int)),
14 ('y', POINTER(c_int))]
15
16 x = X()
17 assert x.y._base is x
18 assert x.y._index == 1
19
20 def test_array():
21 X = POINTER(c_int) * 24
22 x = X()
23 assert x[16]._base is x
24 assert x[16]._index == 16