summaryrefslogtreecommitdiff
path: root/c/test_c.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2020-05-20 09:50:30 +0200
committerArmin Rigo <arigo@tunes.org>2020-05-20 09:50:30 +0200
commit680aa960da02dfa304c6b889489c05c38de89318 (patch)
tree45271b0e14203179a6167d39803ad5702226c743 /c/test_c.py
parent51f577576c16486b46c8c4abb2c8425fa9533063 (diff)
downloadcffi-680aa960da02dfa304c6b889489c05c38de89318.tar.gz
Issue #447
Fix the name of some types to be exactly the name under which they are exposed. Put underscores in front of the CDataXxx type names and a docstring that explains why.
Diffstat (limited to 'c/test_c.py')
-rw-r--r--c/test_c.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/c/test_c.py b/c/test_c.py
index 3b34999..85e75b7 100644
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -109,7 +109,7 @@ def test_cast_to_signed_char():
p = new_primitive_type("signed char")
x = cast(p, -65 + 17*256)
assert repr(x) == "<cdata 'signed char' -65>"
- assert repr(type(x)) == "<%s '_cffi_backend.CData'>" % type_or_class
+ assert repr(type(x)) == "<%s '_cffi_backend.__CDataBase'>" % type_or_class
assert int(x) == -65
x = cast(p, -66 + (1<<199)*256)
assert repr(x) == "<cdata 'signed char' -66>"
@@ -4453,3 +4453,10 @@ def test_huge_structure():
BStruct = new_struct_type("struct foo")
complete_struct_or_union(BStruct, [('a1', BArray, -1)])
assert sizeof(BStruct) == sys.maxsize
+
+def test_type_names():
+ assert (CType.__module__, CType.__name__) == ('_cffi_backend', 'CType')
+ assert (CField.__module__, CField.__name__) == ('_cffi_backend', 'CField')
+ CData, CType1 = _get_types()
+ assert CType1 is CType
+ assert (CData.__module__, CData.__name__) == ('_cffi_backend','__CDataBase')