#NEWLINE# def test_copy_static_table( self ) : #NEWLINE# #INDENT# 'Copy a two-column table to a file' #NEWLINE# self . db . execute ( CREATE_STMT ) #NEWLINE# for row in TABLE_DATA : #NEWLINE# #INDENT# self . db . execute ( 'INSERT INTO t1 VALUES (%s, %s)' , row ) #NEWLINE# #UNINDENT# cfg = { #NEWLINE# #INDENT# 'datacopy' : { #NEWLINE# #INDENT# 'schema public' : [ 't1' ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# dbmap = self . to_map ( [ ] , config = cfg ) #NEWLINE# assert ( dbmap [ 'schema public' ] [ 'table t1' ] == { #NEWLINE# #INDENT# 'columns' : [ { #NEWLINE# #INDENT# 'c1' : { #NEWLINE# #INDENT# 'type' : 'integer' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'c2' : { #NEWLINE# #INDENT# 'type' : 'text' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# recs = [ ] #NEWLINE# with open ( os . path . join ( self . cfg [ 'files' ] [ 'data_path' ] , 'schema.public' , FILE_PATH ) ) as f : #NEWLINE# #INDENT# for line in f : #NEWLINE# #INDENT# ( c1 , c2 ) = line . split ( ',' ) #NEWLINE# recs . append ( ( int ( c1 ) , c2 . rstrip ( ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# assert ( recs == TABLE_DATA )