コード例 #1
0
def test_initialize_from_file_like():
    from io import BytesIO

    config = BytesIO(yaml.dump(config_val, encoding=("utf-8")))
    model = StochasticCollocation()
    model.initialize(config)
    assert_true(os.path.exists(dakota_files["input"]))
コード例 #2
0
def test_initialize_from_file():
    import tempfile

    with tempfile.NamedTemporaryFile("w", delete=False) as fp:
        fp.write(yaml.dump(config_val))
        fname = fp.name

    model = StochasticCollocation()
    model.initialize(fname)
    os.remove(fname)
    assert_true(os.path.exists(dakota_files["input"]))
コード例 #3
0
def test_update():
    if is_dakota_installed():
        model = StochasticCollocation()
        model.initialize()
        model.update()
        assert_true(os.path.exists(dakota_files["input"]))
        assert_true(os.path.exists(dakota_files["output"]))
        assert_true(os.path.exists(dakota_files["data"]))
コード例 #4
0
def test_finalize():
    if is_dakota_installed():
        model = StochasticCollocation()
        model.initialize()
        model.update()
        model.finalize()
コード例 #5
0
def test_initialize_defaults():
    model = StochasticCollocation()
    model.initialize()
    assert_true(os.path.exists(dakota_files["input"]))
コード例 #6
0
def test_time_step():
    model = StochasticCollocation()
    assert_equal(model.get_time_step(), 1.0)
コード例 #7
0
def test_current_time():
    model = StochasticCollocation()
    assert_equal(model.get_current_time(), 0.0)
コード例 #8
0
def test_end_time():
    model = StochasticCollocation()
    model.initialize()
    assert_equal(model.get_end_time(), 1.0)
コード例 #9
0
def test_component_name():
    model = StochasticCollocation()
    name = model.get_component_name()
    assert_equal(name, "StochasticCollocation")
    assert_is(model.get_component_name(), name)