(self, testcase: DataDrivenTestCase)
| 22 | files = ["diff.test"] |
| 23 | |
| 24 | def run_case(self, testcase: DataDrivenTestCase) -> None: |
| 25 | first_src = "\n".join(testcase.input) |
| 26 | files_dict = dict(testcase.files) |
| 27 | second_src = files_dict["tmp/next.py"] |
| 28 | options = parse_options(first_src, testcase, 1) |
| 29 | if options.python_version > sys.version_info: |
| 30 | pytest.skip("Test case requires a newer Python version") |
| 31 | |
| 32 | messages1, files1 = self.build(first_src, options) |
| 33 | messages2, files2 = self.build(second_src, options) |
| 34 | |
| 35 | a = [] |
| 36 | if messages1: |
| 37 | a.extend(messages1) |
| 38 | if messages2: |
| 39 | a.append("== next ==") |
| 40 | a.extend(messages2) |
| 41 | |
| 42 | assert ( |
| 43 | files1 is not None and files2 is not None |
| 44 | ), "cases where CompileError occurred should not be run" |
| 45 | prefix = "__main__" |
| 46 | snapshot1 = snapshot_symbol_table(prefix, files1["__main__"].names) |
| 47 | snapshot2 = snapshot_symbol_table(prefix, files2["__main__"].names) |
| 48 | diff = compare_symbol_table_snapshots(prefix, snapshot1, snapshot2) |
| 49 | for trigger in sorted(diff): |
| 50 | a.append(trigger) |
| 51 | |
| 52 | assert_string_arrays_equal( |
| 53 | testcase.output, a, f"Invalid output ({testcase.file}, line {testcase.line})" |
| 54 | ) |
| 55 | |
| 56 | def build(self, source: str, options: Options) -> tuple[list[str], dict[str, MypyFile] | None]: |
| 57 | options.use_builtins_fixtures = True |
nothing calls this directly
no test coverage detected