#NEWLINE# def test_matrix2numpy_conversion( ) : #NEWLINE# #INDENT# a = Matrix ( [ [ 1 , 2 , sin ( x ) ] , [ ( x ** 2 ) , x , Rational ( 1 , 2 ) ] ] ) #NEWLINE# b = array ( [ [ 1 , 2 , sin ( x ) ] , [ ( x ** 2 ) , x , Rational ( 1 , 2 ) ] ] ) #NEWLINE# assert ( matrix2numpy ( a ) == b ) . all ( ) #NEWLINE# assert ( matrix2numpy ( a ) . dtype == numpy . dtype ( 'object' ) ) #NEWLINE# c = matrix2numpy ( Matrix ( [ [ 1 , 2 ] , [ 10 , 20 ] ] ) , dtype = 'int8' ) #NEWLINE# d = matrix2numpy ( Matrix ( [ [ 1 , 2 ] , [ 10 , 20 ] ] ) , dtype = 'float64' ) #NEWLINE# assert ( c . dtype == numpy . dtype ( 'int8' ) ) #NEWLINE# assert ( d . dtype == numpy . dtype ( 'float64' ) )