#NEWLINE# def test_expect_dtypes( self ) : #NEWLINE# #INDENT# @ expect_dtypes ( a = dtype ( float ) , b = dtype ( 'datetime64[ns]' ) ) #NEWLINE# def foo( a , b , c ) : #NEWLINE# #INDENT# return ( a , b , c ) #NEWLINE# #UNINDENT# good_a = arange ( 3 , dtype = float ) #NEWLINE# good_b = arange ( 3 ) . astype ( 'datetime64[ns]' ) #NEWLINE# good_c = object ( ) #NEWLINE# ( a_ret , b_ret , c_ret ) = foo ( good_a , good_b , good_c ) #NEWLINE# self . assertIs ( a_ret , good_a ) #NEWLINE# self . assertIs ( b_ret , good_b ) #NEWLINE# self . assertIs ( c_ret , good_c ) #NEWLINE# with self . assertRaises ( TypeError ) as e : #NEWLINE# #INDENT# foo ( good_a , arange ( 3 , dtype = 'int64' ) , good_c ) #NEWLINE# #UNINDENT# expected_message = "{qualname}() expected a value with dtype 'datetime64[ns]' for argument 'b', but got 'int64' instead." . format ( qualname = qualname ( foo ) ) #NEWLINE# self . assertEqual ( e . exception . args [ 0 ] , expected_message ) #NEWLINE# with self . assertRaises ( TypeError ) as e : #NEWLINE# #INDENT# foo ( arange ( 3 , dtype = 'uint32' ) , good_c , good_c ) #NEWLINE# #UNINDENT# expected_message = "{qualname}() expected a value with dtype 'float64' for argument 'a', but got 'uint32' instead." . format ( qualname = qualname ( foo ) ) #NEWLINE# self . assertEqual ( e . exception . args [ 0 ] , expected_message )