Exemplo n.º 1
0
    def test_basic(self):
        setup = input.load_setup('tests/test_input_basic.yaml')
        for k in ['templates', 'files', 'executable', 'cmdargs']:
            setup[k] = list(map(methodcaller('render'), setup[k]))

        assert setup['templates'] == ['alpha bravo']
        assert setup['files'] == ['one', 'two', 'three']
        assert setup['executable'] == [r'charlie \n delta', 'echo']
        assert setup['cmdargs'] == ['echo', 'foxtrot', 'golf', r'hotel \ india']

        assert setup['parameters'] == OrderedDict([
            ('degree', [1, 2]),
            ('elements', [8, 16]),
            ('timestep', [0.1, 0.05]),
        ])
        assert all(isinstance(v, int) for v in setup['parameters']['degree'])
        assert all(isinstance(v, int) for v in setup['parameters']['elements'])
        assert all(isinstance(v, float) for v in setup['parameters']['timestep'])

        assert setup['dependencies'] == OrderedDict([
            ('raiseorder', 'degree - 1'),
            ('refineu', 'elements//8 - 1'),
            ('refinev', 'elements - 1'),
            ('endtime', '10'),
        ])

        assert setup['parse'] == ['regexp1', r'complicated regexp \s+']

        assert setup['types'] == OrderedDict([
            ('p_rel_l2', 'float'),
            ('cpu_time', 'bool'),
            ('wall_time', 'str'),
        ])
Exemplo n.º 2
0
    def test_minimal(self):
        setup = input.load_setup('tests/test_input_minimal.yaml')
        for k in ['executable']:
            setup[k] = list(map(methodcaller('render'), setup[k]))

        assert setup['executable'] == ['alpha', 'bravo', 'charlie']
        for k in ['templates', 'files', 'cmdargs', 'parse']:
            assert setup[k] == []
        for k in ['dependencies', 'types']:
            assert setup[k] == {}
Exemplo n.º 3
0
    def test_minimal(self):
        setup = input.load_setup('tests/test_input_minimal.yaml')
        for k in ['executable']:
            setup[k] = list(map(methodcaller('render'), setup[k]))

        assert setup['executable'] == ['alpha', 'bravo', 'charlie']
        for k in ['templates', 'files', 'cmdargs', 'parse']:
            assert setup[k] == []
        for k in ['dependencies', 'types']:
            assert setup[k] == {}
Exemplo n.º 4
0
    def test_basic(self):
        setup = input.load_setup('tests/test_input_basic.yaml')
        for k in ['templates', 'files', 'executable', 'cmdargs']:
            setup[k] = list(map(methodcaller('render'), setup[k]))

        assert setup['templates'] == ['alpha bravo']
        assert setup['files'] == ['one', 'two', 'three']
        assert setup['executable'] == [r'charlie \n delta', 'echo']
        assert setup['cmdargs'] == [
            'echo', 'foxtrot', 'golf', r'hotel \ india'
        ]

        assert setup['parameters'] == OrderedDict([
            ('degree', [1, 2]),
            ('elements', [8, 16]),
            ('timestep', [0.1, 0.05]),
        ])
        assert all(isinstance(v, int) for v in setup['parameters']['degree'])
        assert all(isinstance(v, int) for v in setup['parameters']['elements'])
        assert all(
            isinstance(v, float) for v in setup['parameters']['timestep'])

        assert setup['dependencies'] == OrderedDict([
            ('raiseorder', 'degree - 1'),
            ('refineu', 'elements//8 - 1'),
            ('refinev', 'elements - 1'),
            ('endtime', '10'),
        ])

        assert setup['parse'] == ['regexp1', r'complicated regexp \s+']

        assert setup['types'] == OrderedDict([
            ('p_rel_l2', 'float'),
            ('cpu_time', 'bool'),
            ('wall_time', 'str'),
        ])
Exemplo n.º 5
0
 def test_empty(self):
     input.load_setup('tests/test_input_empty.yaml')
Exemplo n.º 6
0
 def test_empty(self):
     input.load_setup('tests/test_input_empty.yaml')