<s> """<STR_LIT>""" <EOL> from azkaban . job import * <EOL> from azkaban . project import Project <EOL> from azkaban . util import AzkabanError , temppath <EOL> from nose . tools import eq_ , ok_ , raises , nottest <EOL> class TestJob ( object ) : <EOL> def test_generate_simple ( self ) : <EOL> job = Job ( { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:b>' : { '<STR_LIT:c>' : <NUM_LIT:2> , '<STR_LIT:d>' : <NUM_LIT:3> } } ) <EOL> with temppath ( ) as path : <EOL> job . build ( path ) <EOL> with open ( path ) as reader : <EOL> eq_ ( reader . read ( ) , '<STR_LIT>' ) <EOL> def test_generate_with_defaults ( self ) : <EOL> defaults = { '<STR_LIT:b>' : { '<STR_LIT:d>' : <NUM_LIT:4> } , '<STR_LIT:e>' : <NUM_LIT:5> } <EOL> job = Job ( defaults , { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:b>' : { '<STR_LIT:c>' : <NUM_LIT:2> , '<STR_LIT:d>' : <NUM_LIT:3> } } ) <EOL> with temppath ( ) as path : <EOL> job . build ( path ) <EOL> with open ( path ) as reader : <EOL> eq_ ( reader . read ( ) , '<STR_LIT>' ) <EOL> def test_generate_with_dependencies ( self ) : <EOL> foo = Job ( ) <EOL> bar = Job ( { '<STR_LIT:a>' : <NUM_LIT:3> } ) <EOL> job = Job ( { '<STR_LIT:a>' : <NUM_LIT:2> , '<STR_LIT>' : '<STR_LIT>' } ) <EOL> with temppath ( ) as path : <EOL> job . build ( path ) <EOL> with open ( path ) as reader : <EOL> eq_ ( reader . read ( ) , '<STR_LIT>' ) <EOL> def test_join_options ( self ) : <EOL> job = Job ( { '<STR_LIT:bar>' : range ( <NUM_LIT:3> ) } ) <EOL> job . join_option ( '<STR_LIT:bar>' , '<STR_LIT:U+002C>' ) <EOL> eq_ ( job . options [ '<STR_LIT:bar>' ] , '<STR_LIT>' ) <EOL> def test_join_options_with_custom_formatter ( self ) : <EOL> job = Job ( { '<STR_LIT:bar>' : range ( <NUM_LIT:3> ) } ) <EOL> job . join_option ( '<STR_LIT:bar>' , '<STR_LIT:U+0020>' , '<STR_LIT>' ) <EOL> eq_ ( job . options [ '<STR_LIT:bar>' ] , '<STR_LIT>' ) <EOL> def test_join_missing_option ( self ) : <EOL> job = Job ( { '<STR_LIT:bar>' : '<STR_LIT:1>' } ) <EOL> job . join_option ( '<STR_LIT>' , '<STR_LIT:U+0020>' , '<STR_LIT>' ) <EOL> eq_ ( job . options [ '<STR_LIT:bar>' ] , '<STR_LIT:1>' ) <EOL> ok_ ( not '<STR_LIT>' in job . options ) <EOL> def test_join_prefix ( self ) : <EOL> job = Job ( { '<STR_LIT:bar>' : { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT:foo>' } } ) <EOL> job . join_prefix ( '<STR_LIT:bar>' , '<STR_LIT:U+002C>' , '<STR_LIT>' ) <EOL> eq_ ( job . options [ '<STR_LIT:bar>' ] , '<STR_LIT>' ) </s>
