#NEWLINE# def testColumnFilter( self ) : #NEWLINE# #INDENT# 'Tests column filtering.\n\n    Note the second column is not wanted in the config.\n    ' #NEWLINE# config = { #NEWLINE# #INDENT# 'sinks' : [ '/bucket/output_file' , '/bucket/output_file_badrows' ] , #NEWLINE# 'fieldDelimiter' : ',' , #NEWLINE# 'sources' : [ 'input-file' ] , #NEWLINE# 'skipLeadingRows' : 1 , #NEWLINE# 'type' : 'Data Pipeline' , #NEWLINE# 'columns' : [ { #NEWLINE# #INDENT# 'wanted' : True , #NEWLINE# 'type' : 'STRING' , #NEWLINE# 'name' : 'Name' , #NEWLINE# 'transformations' : [ ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'wanted' : False , #NEWLINE# 'type' : 'STRING' , #NEWLINE# 'name' : 'CapitalName' , #NEWLINE# 'transformations' : [ ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'wanted' : True , #NEWLINE# 'type' : 'INTEGER' , #NEWLINE# 'name' : 'Number' , #NEWLINE# 'transformations' : [ ] , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } #NEWLINE# input_file = cStringIO . StringIO ( 'abc,ABC,1\ndef,DEF,2\n' ) #NEWLINE# output_file = cStringIO . StringIO ( ) #NEWLINE# csv_transformer_mapper_tmpl . Transform ( json . dumps ( config ) , input_file , output_file ) #NEWLINE# self . assertEqual ( 'abc,1\ndef,2\n' , output_file . getvalue ( ) )