Debian Codegraph @

tests/data/cases/nested_stub.py

raw
1 # flags: --pyi
2 import sys
3
4 class Outer:
5 class InnerStub: ...
6 outer_attr_after_inner_stub: int
7 class Inner:
8 inner_attr: int
9 outer_attr: int
10
11 if sys.version_info > (3, 7):
12 if sys.platform == "win32":
13 assignment = 1
14 def function_definition(self): ...
15 def f1(self) -> str: ...
16 if sys.platform != "win32":
17 def function_definition(self): ...
18 assignment = 1
19 def f2(self) -> str: ...
20
21
22 class TopLevel:
23 class Nested1:
24 foo: int
25 def bar(self): ...
26 field = 1
27
28 class Nested2:
29 def bar(self): ...
30 foo: int
31 field = 1
32
33 # output
34
35 import sys
36
37 class Outer:
38 class InnerStub: ...
39 outer_attr_after_inner_stub: int
40
41 class Inner:
42 inner_attr: int
43
44 outer_attr: int
45
46 if sys.version_info > (3, 7):
47 if sys.platform == "win32":
48 assignment = 1
49 def function_definition(self): ...
50
51 def f1(self) -> str: ...
52 if sys.platform != "win32":
53 def function_definition(self): ...
54 assignment = 1
55
56 def f2(self) -> str: ...
57
58 class TopLevel:
59 class Nested1:
60 foo: int
61 def bar(self): ...
62
63 field = 1
64
65 class Nested2:
66 def bar(self): ...
67 foo: int
68
69 field = 1