mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-09 13:32:20 +08:00
first succeeding precedence tests
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
"""
|
||||
Test Jedi's operation understanding. Jedi should understand simple additions,
|
||||
multiplications, etc.
|
||||
"""
|
||||
x = [1, '', 'a', 1.0]
|
||||
|
||||
#? int() str() float()
|
||||
x[12]
|
||||
|
||||
#? str()
|
||||
x[1 + 1]
|
||||
|
||||
index = 0 + 1
|
||||
|
||||
#? str()
|
||||
x[index]
|
||||
|
||||
|
||||
def calculate(number):
|
||||
return number + constant
|
||||
|
||||
constant = 1
|
||||
|
||||
#? float()
|
||||
x[calculate(2)]
|
||||
13
test/test_evaluate/test_precedence.py
Normal file
13
test/test_evaluate/test_precedence.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from jedi.evaluate import precedence
|
||||
|
||||
|
||||
def test_simple():
|
||||
p = precedence.create_precedence(iter([1, '+', 2]))
|
||||
assert p.left == 1
|
||||
assert p.operator == '+'
|
||||
assert p.right == 2
|
||||
|
||||
|
||||
def test_invalid():
|
||||
"""Should just return a simple operation"""
|
||||
assert precedence.create_precedence(iter([1, '+'])) == 1
|
||||
Reference in New Issue
Block a user