|
7 | 7 | import faslr.core as core |
8 | 8 | from faslr.index import ( |
9 | 9 | calculate_index_factors, |
10 | | - IndexPane, |
11 | 10 | IndexInventory |
12 | 11 | ) |
13 | 12 |
|
14 | | -from faslr.model import FModelIndex |
15 | | - |
16 | 13 | from faslr.methods.expected_loss import ( |
17 | 14 | ExpectedLossWidget |
18 | 15 | ) |
19 | 16 |
|
20 | 17 | from faslr.utilities import ( |
21 | 18 | load_sample, |
22 | | - ppa_loss_trend, |
23 | 19 | subset_dict, |
24 | 20 | ) |
25 | 21 |
|
@@ -95,26 +91,6 @@ def df_tort_index( |
95 | 91 |
|
96 | 92 | return df_res |
97 | 93 |
|
98 | | - |
99 | | -@pytest.fixture() |
100 | | -def index_pane( |
101 | | - qtbot: QtBot |
102 | | -) -> IndexPane: |
103 | | - """ |
104 | | - Setup common index pane used for testing. |
105 | | - :param qtbot: The QtBot fixture. |
106 | | - :return: An IndexPane object. |
107 | | - """ |
108 | | - |
109 | | - dummy_ays = list(range(2000, 2009)) |
110 | | - |
111 | | - index_pane = IndexPane(years=dummy_ays) |
112 | | - |
113 | | - qtbot.addWidget(index_pane) |
114 | | - |
115 | | - yield index_pane |
116 | | - |
117 | | - |
118 | 94 | @pytest.fixture() |
119 | 95 | def expected_loss( |
120 | 96 | qtbot: QtBot |
@@ -146,95 +122,6 @@ def expected_loss( |
146 | 122 | yield widget |
147 | 123 |
|
148 | 124 |
|
149 | | -def test_index_pane( |
150 | | - qtbot: QtBot, |
151 | | - index_pane: IndexPane |
152 | | -) -> None: |
153 | | - """ |
154 | | - Test initialization of index pane and enter a constant trend factor. |
155 | | - :param qtbot: The QtBot fixture. |
156 | | - :param index_pane: The index_pane fixture. |
157 | | - :return: None. |
158 | | - """ |
159 | | - |
160 | | - def constant_handler() -> None: |
161 | | - """ |
162 | | - Handle the constant factor dialog box. |
163 | | - :return: None |
164 | | - """ |
165 | | - |
166 | | - keyboard = Controller() |
167 | | - |
168 | | - dialog = QApplication.activeModalWidget() |
169 | | - |
170 | | - qtbot.waitUntil( |
171 | | - callback=dialog.isVisible, |
172 | | - timeout=5000 |
173 | | - ) |
174 | | - |
175 | | - keyboard.type('.05') |
176 | | - |
177 | | - keyboard.press(Key.enter) |
178 | | - keyboard.release(Key.enter) |
179 | | - |
180 | | - blank_idx = index_pane.model.index(0, 0) |
181 | | - blank_test = index_pane.model.data( |
182 | | - index=blank_idx, |
183 | | - role=Qt.ItemDataRole.DisplayRole |
184 | | - ) |
185 | | - assert blank_test == '' |
186 | | - |
187 | | - QTimer.singleShot( |
188 | | - 500, |
189 | | - constant_handler |
190 | | - ) |
191 | | - |
192 | | - qtbot.mouseClick( |
193 | | - index_pane.constant_btn, |
194 | | - Qt.MouseButton.LeftButton, |
195 | | - delay=1 |
196 | | - ) |
197 | | - |
198 | | - change_idx = index_pane.model.index( |
199 | | - 0, |
200 | | - 0 |
201 | | - ) |
202 | | - |
203 | | - factor_idx = index_pane.model.index( |
204 | | - 0, |
205 | | - 1 |
206 | | - ) |
207 | | - |
208 | | - change_test = index_pane.model.data( |
209 | | - index=change_idx, |
210 | | - role=Qt.ItemDataRole.DisplayRole |
211 | | - ) |
212 | | - |
213 | | - factor_test = index_pane.model.data( |
214 | | - index=factor_idx, |
215 | | - role=Qt.ItemDataRole.DisplayRole |
216 | | - ) |
217 | | - |
218 | | - assert change_test == "5.0%" |
219 | | - |
220 | | - assert factor_test == "1.477" |
221 | | - |
222 | | - |
223 | | -def test_index_pane_blank( |
224 | | - qtbot: QtBot |
225 | | -) -> None: |
226 | | - |
227 | | - """ |
228 | | - Test generation of a blank index pane. |
229 | | - :param qtbot: The QtBot fixture. |
230 | | - :return: None. |
231 | | - """ |
232 | | - |
233 | | - index_pane = IndexPane() |
234 | | - |
235 | | - qtbot.addWidget(index_pane) |
236 | | - |
237 | | - |
238 | 125 | def test_index_inventory( |
239 | 126 | qtbot: QtBot, |
240 | 127 | f_core |
|
0 commit comments