Exemple #1
0
def test_call_expression():
    eq_(evaluate('the_answer() - 42',
                 {'the_answer': lambda: 42}),
        0)
    eq_(evaluate('2 * (1 + mod(x, 3))',
                 {
                     'x': 5,
                     'mod': lambda x, y: x % y,
                 }),
        6)
Exemple #2
0
def test_bound_variable():
    eq_(evaluate('a + 1', {'a': -1}), 0)
Exemple #3
0
def test_basic():
    eq_(evaluate('A + B * 2.0', {'A': 1.0, 'B': 3.1}), 7.2)
Exemple #4
0
def test_unbound_variable():
    evaluate('2 * b + 3', {'a': 0.5})