#NEWLINE# def test_unpack_args( ) : #NEWLINE# #INDENT# ffi = FFI ( ) #NEWLINE# ffi . cdef ( 'void foo0(void); void foo1(int); void foo2(int, int);' ) #NEWLINE# lib = verify ( ffi , 'test_unpack_args' , '\n    void foo0(void) { }\n    void foo1(int x) { }\n    void foo2(int x, int y) { }\n    ' ) #NEWLINE# assert ( 'foo0' in repr ( lib . foo0 ) ) #NEWLINE# assert ( 'foo1' in repr ( lib . foo1 ) ) #NEWLINE# assert ( 'foo2' in repr ( lib . foo2 ) ) #NEWLINE# lib . foo0 ( ) #NEWLINE# lib . foo1 ( 42 ) #NEWLINE# lib . foo2 ( 43 , 44 ) #NEWLINE# e1 = py . test . raises ( TypeError , lib . foo0 , 42 ) #NEWLINE# e2 = py . test . raises ( TypeError , lib . foo0 , 43 , 44 ) #NEWLINE# e3 = py . test . raises ( TypeError , lib . foo1 ) #NEWLINE# e4 = py . test . raises ( TypeError , lib . foo1 , 43 , 44 ) #NEWLINE# e5 = py . test . raises ( TypeError , lib . foo2 ) #NEWLINE# e6 = py . test . raises ( TypeError , lib . foo2 , 42 ) #NEWLINE# e7 = py . test . raises ( TypeError , lib . foo2 , 45 , 46 , 47 ) #NEWLINE# assert ( str ( e1 . value ) == 'foo0() takes no arguments (1 given)' ) #NEWLINE# assert ( str ( e2 . value ) == 'foo0() takes no arguments (2 given)' ) #NEWLINE# assert ( str ( e3 . value ) == 'foo1() takes exactly one argument (0 given)' ) #NEWLINE# assert ( str ( e4 . value ) == 'foo1() takes exactly one argument (2 given)' ) #NEWLINE# assert ( str ( e5 . value ) == 'foo2() takes exactly 2 arguments (0 given)' ) #NEWLINE# assert ( str ( e6 . value ) == 'foo2() takes exactly 2 arguments (1 given)' ) #NEWLINE# assert ( str ( e7 . value ) == 'foo2() takes exactly 2 arguments (3 given)' )