summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2015-12-11 05:16:46 +0100
committerArmin Rigo <arigo@tunes.org>2015-12-11 05:16:46 +0100
commit77abae7920dc5e7d55a8606acbc0824ffbac61a7 (patch)
treeb79557722370a6b76e35b73baf8f804ce9efae1b /testing
parentd303891294c76eee4680084ab11ff550c6c9b5f1 (diff)
downloadcffi-77abae7920dc5e7d55a8606acbc0824ffbac61a7.tar.gz
Add a __class__ attribute on lib objects
Diffstat (limited to 'testing')
-rw-r--r--testing/cffi1/test_ffi_obj.py2
-rw-r--r--testing/cffi1/test_recompiler.py1
2 files changed, 3 insertions, 0 deletions
diff --git a/testing/cffi1/test_ffi_obj.py b/testing/cffi1/test_ffi_obj.py
index 01a26d9..4002e9d 100644
--- a/testing/cffi1/test_ffi_obj.py
+++ b/testing/cffi1/test_ffi_obj.py
@@ -7,6 +7,7 @@ def test_ffi_new():
p = ffi.new("int *")
p[0] = -42
assert p[0] == -42
+ assert type(ffi) is ffi.__class__ is _cffi1_backend.FFI
def test_ffi_subclass():
class FOO(_cffi1_backend.FFI):
@@ -16,6 +17,7 @@ def test_ffi_subclass():
assert foo.x == 42
p = foo.new("int *")
assert p[0] == 0
+ assert type(foo) is foo.__class__ is FOO
def test_ffi_no_argument():
py.test.raises(TypeError, _cffi1_backend.FFI, 42)
diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py
index 61693c8..7d85de9 100644
--- a/testing/cffi1/test_recompiler.py
+++ b/testing/cffi1/test_recompiler.py
@@ -1156,6 +1156,7 @@ def test_import_from_lib():
assert hasattr(lib, '__dict__')
assert lib.__all__ == ['MYFOO', 'mybar'] # but not 'myvar'
assert lib.__name__ == repr(lib)
+ assert lib.__class__ is type(lib)
def test_macro_var_callback():
ffi = FFI()