<s> """<STR_LIT>""" <EOL> import json <EOL> import os <EOL> import re <EOL> import logging <EOL> from src import basetest <EOL> from src . pipelines import linter <EOL> class MockPipeline ( object ) : <EOL> def __init__ ( self , name , config ) : <EOL> self . name = name <EOL> self . config = config <EOL> class LintPipelineTest ( basetest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def getUnterminatedStringMessage ( self , input_string ) : <EOL> try : <EOL> json . loads ( input_string ) <EOL> except ValueError as e : <EOL> if re . match ( '<STR_LIT>' <EOL> r'<STR_LIT>' , e . message ) : <EOL> return e . message <EOL> else : <EOL> raise ValueError ( '<STR_LIT>' <EOL> '<STR_LIT>' % <EOL> ( input_string , e . message ) ) <EOL> raise ValueError ( '<STR_LIT>' % input_string ) <EOL> def testJunk ( self ) : <EOL> bad_strings = ( ( None , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT:">' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' % <EOL> self . getUnterminatedStringMessage ( '<STR_LIT>' ) ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> for ( bad_string , reason ) in bad_strings : <EOL> logging . info ( '<STR_LIT>' , bad_string ) <EOL> pl = linter . PipelineLinter ( bad_string ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : reason } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : linter . PipelineLinter . MSG_MISSING_IO_STAGES } } <EOL> self . assertFalse ( pl . results . valid , '<STR_LIT>' % bad_string ) <EOL> self . assertSameStructure ( expect , pl . results . results , <EOL> '<STR_LIT>' % bad_string ) <EOL> def testSimpleFailure ( self ) : <EOL> pl = linter . PipelineLinter ( '<STR_LIT>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % <EOL> [ '<STR_LIT:object>' , '<STR_LIT>' ] : <EOL> { '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <EOL> linter . StageLinter . MSG_REQUIRE_AT_LEAST_ONE_FMT % <EOL> [ '<STR_LIT:object>' , '<STR_LIT>' ] <EOL> } , <EOL> } ] <EOL> } <EOL> } <EOL> self . assertFalse ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testMissingStageType ( self ) : <EOL> pl = linter . PipelineLinter ( '<STR_LIT>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % None : { <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : linter . StageLinter . MSG_TYPE_NOT_FOUND } } ] } <EOL> } <EOL> self . assertFalse ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testMissingInputStageType ( self ) : <EOL> pl = linter . PipelineLinter ( '<STR_LIT:{}>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : linter . PipelineLinter . MSG_MISSING_IO_STAGES } , <EOL> } <EOL> self . assertFalse ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testBadStageType ( self ) : <EOL> pl = linter . PipelineLinter ( '<STR_LIT>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : { <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' } } ] , <EOL> } <EOL> } <EOL> self . assertFalse ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testBadSection ( self ) : <EOL> pl = linter . PipelineLinter ( '<STR_LIT>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <EOL> linter . PipelineLinter . MSG_UNKNOWN_CONFIG_KEYS_FMT % u'<STR_LIT:input>' } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : linter . PipelineLinter . MSG_MISSING_IO_STAGES } } <EOL> self . assertFalse ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testUpdateNestedDict ( self ) : <EOL> o = { '<STR_LIT:h>' : { '<STR_LIT:b>' : <NUM_LIT:1> } } <EOL> linter . UpdateNestedDict ( o , { '<STR_LIT:h>' : { '<STR_LIT:c>' : <NUM_LIT:2> } } ) <EOL> self . assertSameStructure ( { '<STR_LIT:h>' : { '<STR_LIT:b>' : <NUM_LIT:1> , '<STR_LIT:c>' : <NUM_LIT:2> } } , o ) <EOL> o = { '<STR_LIT:h>' : { '<STR_LIT:b>' : <NUM_LIT:1> } } <EOL> linter . UpdateNestedDict ( o , { '<STR_LIT:z>' : { '<STR_LIT:c>' : <NUM_LIT:2> } } ) <EOL> self . assertSameStructure ( { '<STR_LIT:h>' : { '<STR_LIT:b>' : <NUM_LIT:1> } , '<STR_LIT:z>' : { '<STR_LIT:c>' : <NUM_LIT:2> } } , o ) <EOL> o = { '<STR_LIT:h>' : '<STR_LIT>' } <EOL> linter . UpdateNestedDict ( o , { '<STR_LIT:h>' : '<STR_LIT:k>' } ) <EOL> self . assertSameStructure ( { '<STR_LIT:h>' : '<STR_LIT>' } , o ) <EOL> def testGcsInputOk ( self ) : <EOL> pl = linter . PipelineLinter ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT:object>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % [ '<STR_LIT:object>' , '<STR_LIT>' ] : <EOL> { '<STR_LIT>' : True } , <EOL> } ] } } <EOL> self . assertTrue ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testGcsInputNullSink ( self ) : <EOL> pl = linter . PipelineLinter ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : False , <EOL> '<STR_LIT>' : linter . StageLinter . MSG_FIELD_INVALID_FMT % '<STR_LIT:null>' } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT:object>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % [ '<STR_LIT:object>' , '<STR_LIT>' ] : <EOL> { '<STR_LIT>' : True } , <EOL> } ] } } <EOL> self . assertFalse ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testGcsOutputOk ( self ) : <EOL> pl = linter . PipelineLinter ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT:object>' : <EOL> { '<STR_LIT>' : True } , <EOL> } ] } } <EOL> self . assertTrue ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testGcsCompositorOk ( self ) : <EOL> pl = linter . PipelineLinter ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT:object>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % [ '<STR_LIT:object>' , '<STR_LIT>' ] : <EOL> { '<STR_LIT>' : True } } ] , '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } } ] , '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT:object>' : <EOL> { '<STR_LIT>' : True } } ] <EOL> } } <EOL> self . assertTrue ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testHttpInputOk ( self ) : <EOL> pl = linter . PipelineLinter ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT:url>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> } ] } } <EOL> self . assertTrue ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testHttpInputBadShardSize ( self ) : <EOL> pl = linter . PipelineLinter ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT:url>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> '<STR_LIT>' } , <EOL> } ] } } <EOL> self . assertFalse ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testDatastoreInputOk ( self ) : <EOL> pl = linter . PipelineLinter ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_TYPE_FMT % '<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_TYPE_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % [ '<STR_LIT>' , '<STR_LIT:object>' ] : <EOL> { '<STR_LIT>' : True } , <EOL> } ] } } <EOL> self . assertTrue ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testS3InputOk ( self ) : <EOL> pl = linter . PipelineLinter ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_TYPE_FMT % '<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT:object>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % [ '<STR_LIT:object>' , '<STR_LIT>' ] : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % <EOL> '<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % <EOL> '<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> } ] } } <EOL> self . assertTrue ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testBigQueryOutputOk ( self ) : <EOL> pl = linter . PipelineLinter ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_TYPE_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_TYPE_FMT % '<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_TYPE_FMT % '<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % <EOL> '<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % <EOL> '<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % <EOL> '<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % <EOL> '<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> } ] } } <EOL> self . assertTrue ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testCsvMatchReplaceOk ( self ) : <EOL> pl = linter . PipelineLinter ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> expect = { <EOL> linter . PipelineLinter . CHECK_SYNTAX_VALID : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_UNKNOWN_CONFIG_KEYS : { '<STR_LIT>' : True } , <EOL> linter . PipelineLinter . CHECK_REQ_IO_STAGES : { '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_TYPE_FMT % '<STR_LIT>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , } ] , <EOL> '<STR_LIT>' : [ { <EOL> linter . StageLinter . CHECK_TYPE_FMT % u'<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % <EOL> '<STR_LIT:object>' : { '<STR_LIT>' : True } , <EOL> linter . StageLinter . CHECK_FIELD_EXISTS_FMT % <EOL> [ '<STR_LIT:object>' , '<STR_LIT>' ] : { '<STR_LIT>' : True } } ] } } <EOL> self . assertTrue ( pl . results . valid ) <EOL> self . assertSameStructure ( expect , pl . results . results ) <EOL> def testLintFullFiles ( self ) : <EOL> directories = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> for directory in directories : <EOL> directory = os . path . join ( os . path . dirname ( __file__ ) , <EOL> '<STR_LIT>' , directory ) <EOL> filenames = [ x for x in os . listdir ( directory ) if x . endswith ( '<STR_LIT>' ) ] <EOL> logging . info ( '<STR_LIT>' , directory , filenames ) <EOL> for filename in filenames : <EOL> logging . info ( '<STR_LIT>' , <EOL> filename , os . path . basename ( directory ) ) <EOL> j = open ( os . path . join ( directory , filename ) ) . read ( ) <EOL> pl = linter . PipelineLinter ( j ) <EOL> self . assertTrue ( pl . results . valid ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> basetest . main ( ) </s>
