示例#1
0
def test_simple_subtraction():
    assert tokenize("10 - 5") == [10, "-", 5]
示例#2
0
def test_complex_expression():
    expression = "10 * (20 + 100) / sin(x + 8 ** 2)"
    assert tokenize(expression) == [
        10, '*', '(', 20, '+', 100, ')', '/', 'sin', '(', 'x', '+', 8, '**', 2,
        ')'
    ]
示例#3
0
def test_simple_addition():
    assert tokenize("10 + 5") == [10, "+", 5]
示例#4
0
def test_simple_function():
    assert tokenize("sin(23)") == ["sin", "(", 23, ")"]
示例#5
0
def test_simple_exponent():
    assert tokenize("10 ** 5") == [10, "**", 5]
示例#6
0
def test_simple_modulo():
    assert tokenize("10 % 5") == [10, "%", 5]
示例#7
0
def test_simple_division():
    assert tokenize("10 / 5") == [10, "/", 5]
示例#8
0
def test_simple_multiplication():
    assert tokenize("10 * 5") == [10, "*", 5]