示例#1
0
def index():
    tree = request.get_json(force=True)
    result = math_eval(tree)
    return str(result) + '\n'
def test_identity():
    assert math_eval(5) == 5, 'identity'
def test_single_element():
    assert math_eval(['+', 5]) == 5, 'single element'
def test_nested():
    assert math_eval(['*', ['+', 5, 4], 2]) == 18
def test_addition():
    assert math_eval(['+', 5, 7]) == 12, 'adding two numbers'
示例#6
0
 def _check(self, tree, expected):
     self.assertEqual(math_eval(tree), expected)
示例#7
0
 def _check(self, tree, expected):
     self.assertEqual(math_eval(tree), expected)
示例#8
0
def index():
    tree = request.get_json(force=True)
    result = math_eval(tree);
    return str(result) + "\n"