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)
def test_bound_variable(): eq_(evaluate('a + 1', {'a': -1}), 0)
def test_basic(): eq_(evaluate('A + B * 2.0', {'A': 1.0, 'B': 3.1}), 7.2)
def test_unbound_variable(): evaluate('2 * b + 3', {'a': 0.5})