From 680aa960da02dfa304c6b889489c05c38de89318 Mon Sep 17 00:00:00 2001 From: Armin Rigo Date: Wed, 20 May 2020 09:50:30 +0200 Subject: 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. --- c/test_c.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'c/test_c.py') 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) == "" - 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) == "" @@ -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') -- cgit v1.2.1