def test_kwargs(): source = ''' train model l2: 0.5 alpha: 0.01 ''' assert parse(source) == [ Call(Ident('train'), [ Ident('model'), BinarySlurp([Ident('l2'), Ident(':'), Float(0.5)]), BinarySlurp([Ident('alpha'), Ident(':'), Float(0.01)]), ]) ]
def test_float_sigil(): source = r''' 10 + 3.0i ''' assert parse(source) == [ BinarySlurp([Int(10), Ident('+'), Float(3.0, 'i')]) ]
def test_float_trailing_underscore(): source = ''' x = 3_000_000.000_000_ ''' assert parse(source) == [ BinarySlurp([Ident('x'), Ident('='), Float(3000000.0)]) ]
def test_bigfloat_underscore(): source = ''' x = 3_00.0e1_0 ''' assert parse(source) == [ BinarySlurp([Ident('x'), Ident('='), Float(300e10)]) ]
def test_bigfloat_small(): source = ''' x = 3.0e-10 ''' assert parse(source) == [ BinarySlurp([Ident('x'), Ident('='), Float(3e-10)]) ]
def test_float(): source = ''' x = 3.0 ''' assert parse(source) == [BinarySlurp([Ident('x'), Ident('='), Float(3.0)])]