#NEWLINE# def test_import_from_lib( ) : #NEWLINE# #INDENT# ffi = FFI ( ) #NEWLINE# ffi . cdef ( 'int mybar(int); int myvar;\n#define MYFOO ...' ) #NEWLINE# lib = verify ( ffi , 'test_import_from_lib' , '#define MYFOO 42\nstatic int mybar(int x) { return x + 1; }\nstatic int myvar = -5;' ) #NEWLINE# assert ( sys . modules [ '_CFFI_test_import_from_lib' ] . lib is lib ) #NEWLINE# assert ( sys . modules [ '_CFFI_test_import_from_lib.lib' ] is lib ) #NEWLINE# from _CFFI_test_import_from_lib.lib import MYFOO #NEWLINE# assert ( MYFOO == 42 ) #NEWLINE# assert hasattr ( lib , '__dict__' ) #NEWLINE# assert ( lib . __all__ == [ 'MYFOO' , 'mybar' ] ) #NEWLINE# assert ( ffi . __name__ == repr ( lib ) ) #NEWLINE# assert ( lib . __class__ is type ( lib ) )