#NEWLINE# @ pytest . mark . parametrize ( [ 'sep' , 'header' ] , product ( [ ',' , '|' , '\t' ] , [ True , False ] ) ) #NEWLINE# def test_sqlite_to_csv( sep , header ) : #NEWLINE# #INDENT# with tmpfile ( 'db' ) as dbfilename : #NEWLINE# #INDENT# with filetext ( 'a,b\n1,2\n3,4' , extension = 'csv' ) as csvfilename : #NEWLINE# #INDENT# t = odo ( csvfilename , ( 'sqlite:///%s::mytable' % dbfilename ) ) #NEWLINE# #UNINDENT# with tmpfile ( '.csv' ) as fn : #NEWLINE# #INDENT# odo ( t , fn , header = header , delimiter = sep ) #NEWLINE# with open ( fn , 'rt' ) as f : #NEWLINE# #INDENT# lines = f . readlines ( ) #NEWLINE# #UNINDENT# expected = [ tuple ( map ( int , row ) ) for row in map ( ( lambda x : x . split ( sep ) ) , lines [ header : ] ) ] #NEWLINE# assert ( odo ( fn , list , delimiter = sep , has_header = header , dshape = discover ( t ) ) == expected )