Пример #1
0
def test_py_form11():
    """Test indexed, not dense."""
    d = {'a_1_2': "0", 'a_2_2': "2", 'a_2_1': "1",}
    obs = runtime_parameters.py_form(d)
    exp = {'a': [[0], [1, 2]]}
    assert_equal(obs, exp)
Пример #2
0
def test_py_form9():
    """Test indexed, not dense."""
    d = {'a_1': "0", 'a_10': "2", 'a_2': "1",}
    obs = runtime_parameters.py_form(d)
    exp = {'a_1': 0, 'a_10': 2, 'a_2': 1,}
    assert_equal(obs, exp)
Пример #3
0
def test_py_form10():
    """Test indexed"""
    d = {'a_1_2': "0", 'a_2_2': "2", 'a_2_1': "1", 'a_1_1': "10"}
    obs = runtime_parameters.py_form(d)
    exp = {'a': [[10, 0], [1, 2]]}
    assert_equal(obs, exp)
Пример #4
0
def test_py_form7():
    """Test bools"""
    d = {'a': ".false."}
    obs = runtime_parameters.py_form(d)
    exp = {'a': False}
    assert_equal(obs, exp)
Пример #5
0
def test_py_form8():
    """Test indexed"""
    d = {'a_1': "0", 'a_3': "2", 'a_2': "1",}
    obs = runtime_parameters.py_form(d)
    exp = {'a': range(3)}
    assert_equal(obs, exp)
Пример #6
0
def test_py_form6():
    """Test bools"""
    d = {'a': ".True."}
    obs = runtime_parameters.py_form(d)
    exp = {'a': True}
    assert_equal(obs, exp)
Пример #7
0
def test_py_form5():
    """Test floats"""
    d = {'a': "-4.20e+01"}
    obs = runtime_parameters.py_form(d)
    exp = {'a': -42.0}
    assert_equal(obs, exp)
Пример #8
0
def test_py_form4():
    """Test floats"""
    d = {'a': "42.0"}
    obs = runtime_parameters.py_form(d)
    exp = {'a': 42.0}
    assert_equal(obs, exp)
Пример #9
0
def test_py_form3():
    """Test int"""
    d = {'a': "42"}
    obs = runtime_parameters.py_form(d)
    exp = {'a': 42}
    assert_equal(obs, exp)
Пример #10
0
def test_py_form2():
    """Test strings"""
    d = {'a': '"Hello"'}
    obs = runtime_parameters.py_form(d)
    exp = {'a': "Hello"}
    assert_equal(obs, exp)