Exemple #1
0
def test_io():

    sgfactory = composite_node()

    model = VisualeaModel()
    model.set_code(sgfactory)

    assert model() == 3
    assert model(10, 20) == 30
    assert model.run() == 3
def test_io():

    sgfactory = composite_node()

    model = VisualeaModel()
    model.set_code(sgfactory)

    assert model() == 3
    assert model(10, 20) == 30
    assert model.run() == 3
Exemple #3
0
def test_io_no_default():
    from openalea.core.service.control import new_control, clear_controls
    clear_controls()
    sgfactory = composite_node(None, None)

    model = VisualeaModel()
    model.set_code(sgfactory)

    a = 100
    b = 200
    assert model(namespace=locals()) == 300
    assert model(**locals()) == 300

    new_control('a', 'IInt', 5)
    assert model(a=1, b=20, namespace=locals()) == 21
    assert model(b=20, namespace=locals()) == 25
def test_io_no_default():
    from openalea.core.service.control import new_control, clear_controls

    clear_controls()
    sgfactory = composite_node(None, None)

    model = VisualeaModel()
    model.set_code(sgfactory)

    a = 100
    b = 200
    assert model(namespace=locals()) == 300
    assert model(**locals()) == 300

    new_control("a", "IInt", 5)
    assert model(a=1, b=20, namespace=locals()) == 21
    assert model(b=20, namespace=locals()) == 25