Exemplo n.º 1
0
 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',
     ]
Exemplo n.º 2
0
 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',
     ]
Exemplo n.º 3
0
 def test_no_file(self):
     with no_stderr():
         input.parse_args([])
Exemplo n.º 4
0
 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'])
Exemplo n.º 5
0
 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'
Exemplo n.º 6
0
 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'
Exemplo n.º 7
0
 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'
Exemplo n.º 8
0
 def test_file(self):
     args = input.parse_args(['-l0', 'blergh'])
     assert args.file == 'blergh'
     assert args.output == 'output.yaml'
     assert args.format == 'yaml'
Exemplo n.º 9
0
 def test_no_file(self):
     with no_stderr():
         input.parse_args([])
Exemplo n.º 10
0
 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'])
Exemplo n.º 11
0
 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'
Exemplo n.º 12
0
 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'
Exemplo n.º 13
0
 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'
Exemplo n.º 14
0
 def test_file(self):
     args = input.parse_args(['-l0', 'blergh'])
     assert args.file == 'blergh'
     assert args.output == 'output.yaml'
     assert args.format == 'yaml'