def test_notemp(self): setup = input.empty_setup( ['echo'], cmdargs=['a=$alpha$', 'b=$bravo$', 'c=$charlie$'], parameters=OrderedDict([('alpha', [2, 4]), ('bravo', ['a', 'b'])]), dependencies=OrderedDict([('charlie', 'alpha**2')]), parse=['(?P<out>.+)']) stuff = badger.work(input.parse_args(['-l0', 'foo']), setup) assert stuff['results']['out'] == [ 'a=2 b=a c=4', 'a=2 b=b c=4', 'a=4 b=a c=16', 'a=4 b=b c=16', ]
def test_temp(self): setup = input.empty_setup(['cat'], cmdargs=['tests/template.temp'], templates=['tests/template.temp'], parameters=OrderedDict([ ('alpha', ['a', 'b', 'c']), ('bravo', [1, 2, 3]) ]), parse=['(?P<out>.+)']) stuff = badger.work(input.parse_args(['-l0', 'foo']), setup) assert stuff['results']['out'] == [ 'a=a b=1', 'a=a b=2', 'a=a b=3', 'a=b b=1', 'a=b b=2', 'a=b b=3', 'a=c b=1', 'a=c b=2', 'a=c b=3', ]
def test_no_file(self): with no_stderr(): input.parse_args([])
def test_incorrect_format(self): with no_stderr(): with assert_raises(SystemExit): input.parse_args(['-o', 'foo', '-f', 'baz', 'bar']) with assert_raises(SystemExit): input.parse_args(['-o', 'foo.baz', 'bar'])
def test_all(self): args = input.parse_args(['-l0', '-o', 'foo', '-f', 'yaml', 'bar']) assert args.file == 'bar' assert args.output == 'foo' assert args.format == 'yaml'
def test_format(self): args = input.parse_args(['-l0', '-f', 'py', 'yoink']) assert args.file == 'yoink' assert args.output == 'output.yaml' assert args.format == 'py'
def test_output(self): args = input.parse_args(['-l0', '-o', 'test.py', 'argh']) assert args.file == 'argh' assert args.output == 'test.py' assert args.format == 'py'
def test_file(self): args = input.parse_args(['-l0', 'blergh']) assert args.file == 'blergh' assert args.output == 'output.yaml' assert args.format == 'yaml'