mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-10 07:41:51 +08:00
to the power of precedences
This commit is contained in:
@@ -19,6 +19,7 @@ def parse_tree(statement_string):
|
||||
def test_simple():
|
||||
assert parse_tree('1+2') == (1, '+', 2)
|
||||
assert parse_tree('+2') == (None, '+', 2)
|
||||
assert parse_tree('1+2-3') == ((1, '+', 2), '-', 3)
|
||||
|
||||
|
||||
def test_prefixed():
|
||||
@@ -38,8 +39,15 @@ def test_invalid():
|
||||
assert parse_tree('1 not - 1') == (1, '-', 1)
|
||||
assert parse_tree('1 - not ~1') == (1, '-', (None, '~', 1))
|
||||
|
||||
# not not allowed
|
||||
assert parse_tree('1 is not not 1') == (1, 'is not', 1)
|
||||
|
||||
|
||||
def test_multi_part():
|
||||
assert parse_tree('1 not in 2') == (1, 'not in', 2)
|
||||
assert parse_tree('1 is not -1') == (1, 'is not', (None, '-', 1))
|
||||
assert parse_tree('1 is 1') == (1, 'is', 1)
|
||||
|
||||
|
||||
def test_power():
|
||||
assert parse_tree('2 ** 3 ** 4') == (2, '**', (3, '**', 4))
|
||||
|
||||
Reference in New Issue
Block a user