Пример #1
0
def test_model_get_documentation():
    model_src = '''"""
input = lstring="_(0.01)-(90)F(1)"
output = lstring
"""
N = 2

derivation length: N

production:

F(x) :
  produce  F(x/3.0)+F(x/3.0)--F(x/3.0)+F(x/3.0)

endlsystem
'''
    model = LPyModel(code=model_src)
    assert model.get_documentation() == """input = lstring="_(0.01)-(90)F(1)"
output = lstring"""

    assert model.repr_code() == model_src
Пример #2
0
def test_magic():
    model_src = '''"""
input = lstring="_(0.01)-(90)F(1)", a=1
output = lstring
"""

%pylab inline
N = 2

derivation length: N

production:

F(x) :
  produce  F(x/3.0)+F(x/3.0)--F(x/3.0)+F(x/3.0)

endlsystem
'''
    model = LPyModel(code=model_src)
    assert model.repr_code() == model_src
    assert len(model.inputs_info) == 2
    assert len(model.outputs_info) == 1