Debian Codegraph @

test/completion/named_expression.py

raw symbols SCIP
1 # For assignment expressions / named expressions / walrus operators / whatever
2 # they are called.
3
4 b = (a:=1, a)
5
6 #? int()
7 b[0]
8 #?
9 b[1]
10
11 # Should not fail
12 b = ('':=1,)
13
14 #? int()
15 b[0]
16
17 def test_assignments():
18 match = ''
19 #? str()
20 match
21 #? 8 int()
22 if match := 1:
23 #? int()
24 match
25 #? int()
26 match
27
28 def test_assignments2():
29 class Foo:
30 match = ''
31 #? str()
32 Foo.match
33 #? 13 int()
34 if Foo.match := 1:
35 #? str()
36 Foo.match
37 #? str()
38 Foo.match
39
40 #?
41 y
42 #? 16 str()
43 if y := Foo.match:
44 #? str()
45 y
46 #? str()
47 y
48
49 #? 8 str()
50 if z := Foo.match:
51 pass