#NEWLINE# def _test_file_custom( self , parquet_file , csv_file ) : #NEWLINE# #INDENT# ' Given the parquet_file and csv_file representation, converts the\n            parquet_file to json using the dump utility and then compares the\n            result to the csv_file using column agnostic ordering.\n        ' #NEWLINE# expected_data = [ ] #NEWLINE# with open ( csv_file , 'rb' ) as f : #NEWLINE# #INDENT# expected_data = list ( csv . reader ( f , delimiter = '|' ) ) #NEWLINE# #UNINDENT# def _custom_datatype( in_dict , keys ) : #NEWLINE# #INDENT# '\n            return rows like the csv outputter\n\n            Could convert to a dataframe like this:\n                import pandas\n                df = pandas.DataFrame(in_dict)\n                return df\n            ' #NEWLINE# columns = [ in_dict [ key ] for key in keys ] #NEWLINE# rows = zip ( * columns ) #NEWLINE# return rows #NEWLINE# #UNINDENT# actual_data = parquet . dump ( parquet_file , Options ( format = 'custom' ) , out = _custom_datatype ) #NEWLINE# assert ( len ( expected_data ) == len ( actual_data ) ) #NEWLINE# footer = parquet . read_footer ( s ) #NEWLINE# cols = [ s . name for s in footer . schema ] #NEWLINE# for ( expected , actual ) in zip ( expected_data , actual_data ) : #NEWLINE# #INDENT# assert ( len ( expected ) == len ( actual ) ) #NEWLINE# for ( i , c ) in enumerate ( cols ) : #NEWLINE# #INDENT# if ( c in actual ) : #NEWLINE# #INDENT# assert ( expected [ i ] == actual [ c ] )