mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Basic implementation support for namedexpr, fixes #1647
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
x = 3
|
||||
if NOT_DEFINED:
|
||||
x = ''
|
||||
#? 6 int()
|
||||
#? 6 int() str()
|
||||
elif x:
|
||||
pass
|
||||
else:
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# For assignment expressions / named expressions / walrus operators / whatever
|
||||
# they are called.
|
||||
|
||||
# python >= 3.8
|
||||
b = (a:=1, a)
|
||||
|
||||
@@ -11,3 +14,39 @@ b = ('':=1,)
|
||||
|
||||
#? int()
|
||||
b[0]
|
||||
|
||||
def test_assignments():
|
||||
match = ''
|
||||
#? str()
|
||||
match
|
||||
#? 8 int()
|
||||
if match := 1:
|
||||
#? int()
|
||||
match
|
||||
#? int()
|
||||
match
|
||||
|
||||
def test_assignments2():
|
||||
class Foo:
|
||||
match = ''
|
||||
#? str()
|
||||
Foo.match
|
||||
#? 13 int()
|
||||
if Foo.match := 1:
|
||||
#? str()
|
||||
Foo.match
|
||||
#? str()
|
||||
Foo.match
|
||||
|
||||
#?
|
||||
y
|
||||
#? 16 str()
|
||||
if y := Foo.match:
|
||||
#? str()
|
||||
y
|
||||
#? str()
|
||||
y
|
||||
|
||||
#? 8 str()
|
||||
if z := Foo.match:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user