(self, method, expected_as_str, expected_as_str_source_version=None, update_try_except_infos=None)
| 153 | self.pyfile = pyfile |
| 154 | |
| 155 | def check(self, method, expected_as_str, expected_as_str_source_version=None, update_try_except_infos=None): |
| 156 | code = method.__code__ |
| 157 | |
| 158 | try_except_infos = sorted(collect_try_except_info(code, use_func_first_line=True), key=lambda t:t.try_line) |
| 159 | if IS_CPYTHON or IS_PYPY: |
| 160 | if update_try_except_infos is not None: |
| 161 | update_try_except_infos(try_except_infos) |
| 162 | |
| 163 | if sys.version_info[:2] not in ((3, 10), (3, 11), (3, 12), (3, 13), (3, 14)): |
| 164 | assert str(try_except_infos) == expected_as_str |
| 165 | from _pydevd_bundle.pydevd_collect_bytecode_info import collect_try_except_info_from_source |
| 166 | |
| 167 | expected_as_str_source_version = expected_as_str_source_version or expected_as_str |
| 168 | try_except_infos = collect_try_except_info_from_source(self.pyfile(method)) |
| 169 | if update_try_except_infos is not None: |
| 170 | update_try_except_infos(try_except_infos) |
| 171 | assert str(try_except_infos) == expected_as_str_source_version |
| 172 | else: |
| 173 | assert try_except_infos == [] |
| 174 | |
| 175 | |
| 176 | @pytest.fixture |
no test coverage detected