def test_float_variations():
    grammar = """
        Rule: a*=FLOAT[',']
        ;
    """
    meta = metamodel_from_str(grammar)

    model = meta.model_from_str('3.5, .4, 5.0')
    assert len(model.a) == 3
    assert type(model.a[0]) is float
    assert type(model.a[1]) is float
    assert type(model.a[2]) is float

    # Check scientific notation
    model = meta.model_from_str('1e-2')
    assert model.a[0] == 0.01
Test different float formats.
dataset/ETHPy150Open igordejanovic/textX/tests/functional/test_textx_language.py/test_float_variations