コード例 #1
0
ファイル: test_tokenizer.py プロジェクト: JanMaier97/PyCal
def test_simple_subtraction():
    assert tokenize("10 - 5") == [10, "-", 5]
コード例 #2
0
ファイル: test_tokenizer.py プロジェクト: JanMaier97/PyCal
def test_complex_expression():
    expression = "10 * (20 + 100) / sin(x + 8 ** 2)"
    assert tokenize(expression) == [
        10, '*', '(', 20, '+', 100, ')', '/', 'sin', '(', 'x', '+', 8, '**', 2,
        ')'
    ]
コード例 #3
0
ファイル: test_tokenizer.py プロジェクト: JanMaier97/PyCal
def test_simple_addition():
    assert tokenize("10 + 5") == [10, "+", 5]
コード例 #4
0
ファイル: test_tokenizer.py プロジェクト: JanMaier97/PyCal
def test_simple_function():
    assert tokenize("sin(23)") == ["sin", "(", 23, ")"]
コード例 #5
0
ファイル: test_tokenizer.py プロジェクト: JanMaier97/PyCal
def test_simple_exponent():
    assert tokenize("10 ** 5") == [10, "**", 5]
コード例 #6
0
ファイル: test_tokenizer.py プロジェクト: JanMaier97/PyCal
def test_simple_modulo():
    assert tokenize("10 % 5") == [10, "%", 5]
コード例 #7
0
ファイル: test_tokenizer.py プロジェクト: JanMaier97/PyCal
def test_simple_division():
    assert tokenize("10 / 5") == [10, "/", 5]
コード例 #8
0
ファイル: test_tokenizer.py プロジェクト: JanMaier97/PyCal
def test_simple_multiplication():
    assert tokenize("10 * 5") == [10, "*", 5]