Debian Codegraph @

test/completion/pytest.py

raw symbols SCIP
1 from typing import Generator
2
3 import pytest
4 from pytest import fixture
5
6
7 @pytest.fixture(scope='module')
8 def my_fixture() -> str:
9 pass
10
11
12 @fixture
13 def my_simple_fixture():
14 return 1
15
16
17 @fixture
18 def my_yield_fixture():
19 yield 1
20
21
22 @fixture
23 class MyClassFixture():
24 pass
25
26 # -----------------
27 # goto/infer
28 # -----------------
29
30 #! 18 ['def my_conftest_fixture']
31 def test_x(my_conftest_fixture, my_fixture, my_not_existing_fixture, my_yield_fixture):
32 #? str()
33 my_fixture
34 #? int()
35 my_yield_fixture
36 #?
37 my_not_existing_fixture
38 #? float()
39 return my_conftest_fixture
40
41 #? 18 float()
42 def test_x(my_conftest_fixture, my_fixture):
43 pass
44
45
46 #! 18 ['param MyClassFixture']
47 def test_x(MyClassFixture):
48 #?
49 MyClassFixture
50
51 #? 15
52 def lala(my_fixture):
53 pass
54
55 @pytest.fixture
56 #? 15 str()
57 def lala(my_fixture):
58 pass
59
60 #! 15 ['param my_fixture']
61 def lala(my_fixture):
62 pass
63
64 @pytest.fixture
65 #! 15 ['def my_fixture']
66 def lala(my_fixture):
67 pass
68
69 # overriding types of a fixture should be possible
70 def test_x(my_yield_fixture: str):
71 #? str()
72 my_yield_fixture
73
74 # -----------------
75 # completion
76 # -----------------
77
78 #? 34 ['my_fixture']
79 def test_x(my_simple_fixture, my_fixture):
80 return
81 #? 34 ['my_fixture']
82 def test_x(my_simple_fixture, my_fixture):
83 return
84 #? ['my_fixture']
85 def test_x(my_simple_fixture, my_f
86 return
87 #? 18 ['my_simple_fixture']
88 def test_x(my_simple_fixture):
89 return
90 #? ['my_simple_fixture']
91 def test_x(my_simp
92 return
93 #? ['my_conftest_fixture']
94 def test_x(my_con
95 return
96 #? 18 ['my_conftest_fixture']
97 def test_x(my_conftest_fixture):
98 return
99 #? ['my_module_fixture']
100 def test_x(my_modu
101 return
102
103 #? []
104 def lala(my_con
105 return
106
107 @pytest.fixture
108 #? ['my_conftest_fixture']
109 def lala(my_con
110 return
111
112 @pytest.fixture
113 #? 15 ['my_conftest_fixture']
114 def lala(my_con):
115 return
116
117 @pytest.fixture
118 @some_decorator
119 #? ['my_conftest_fixture']
120 def lala(my_con
121 return
122
123 @pytest.fixture
124 @some_decorator
125 #? 15 ['my_conftest_fixture']
126 def lala(my_con):
127 return
128
129 # -----------------
130 # pytest owned fixtures
131 # -----------------
132
133 #? ['monkeypatch']
134 def test_p(monkeyp
135
136
137 #! 15 ['def monkeypatch']
138 def test_p(monkeypatch):
139 #? ['setattr']
140 monkeypatch.setatt
141
142 #? ['capsysbinary']
143 def test_p(capsysbin
144
145
146 def close_parens():
147 pass
148 # -----------------
149 # inheritance
150 # -----------------
151
152 @fixture
153 #? 40 ['inheritance_fixture']
154 def inheritance_fixture(inheritance_fixture):
155 #? str()
156 inheritance_fixture
157 #? ['upper']
158 inheritance_fixture.upper
159 return 1
160
161
162 #! 48 ['def inheritance_fixture']
163 def test_inheritance_fixture(inheritance_fixture, caplog):
164 #? int()
165 inheritance_fixture
166
167 #? ['set_level']
168 caplog.set_le
169
170
171 @pytest.fixture
172 def caplog(caplog):
173 yield caplog
174
175 # -----------------
176 # Generator with annotation
177 # -----------------
178
179 @pytest.fixture
180 def with_annot() -> Generator[float, None, None]:
181 pass
182
183 def test_with_annot(inheritance_fixture, with_annot):
184 #? float()
185 with_annot
186
187 # -----------------
188 # pytest external plugins
189 # -----------------
190
191 #? ['admin_user', 'admin_client']
192 def test_z(admin
193
194 #! 15 ['def admin_client']
195 def test_p(admin_client):
196 #? ['login', 'logout']
197 admin_client.log
198
199 @pytest.fixture
200 @some_decorator
201 #? ['admin_user']
202 def bla(admin_u
203 return
204
205 @pytest.fixture
206 @some_decorator
207 #! 12 ['def admin_user']
208 def bla(admin_user):
209 pass
210