#NEWLINE# @ dec . skipif ( _ctypes_missing , msg = 'Ctypes library could not be found' ) #NEWLINE# def setUp( self ) : #NEWLINE# #INDENT# if ( sys . platform == 'win32' ) : #NEWLINE# #INDENT# if ( sys . version_info < ( 3 , 5 ) ) : #NEWLINE# #INDENT# file = ctypes . util . find_msvcrt ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# file = 'api-ms-win-crt-math-l1-1-0.dll' #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( sys . platform == 'darwin' ) : #NEWLINE# #INDENT# file = 'libm.dylib' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# file = 'libm.so' #NEWLINE# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# self . lib = ctypes . CDLL ( file ) #NEWLINE# #UNINDENT# except OSError : #NEWLINE# #INDENT# self . skipTest ( "Ctypes can't import libm.so" ) #NEWLINE# #UNINDENT# restype = ctypes . c_double #NEWLINE# argtypes = ( ctypes . c_double , ) #NEWLINE# for name in [ 'sin' , 'cos' , 'tan' ] : #NEWLINE# #INDENT# func = getattr ( self . lib , name ) #NEWLINE# func . restype = name #NEWLINE# func . argtypes = argtypes