| 1 | # Test file with errors that generate long diagnostic messages |
| 2 | |
| 3 | from typing import Callable, Dict, List, Optional, Union |
| 4 | |
| 5 | # Type mismatch with long type names |
| 6 | def process_data( |
| 7 | data: Dict[str, List[Union[int, float, str, None]]] |
| 8 | ) -> Dict[str, List[Union[int, float]]]: |
| 9 | return data # Error: incompatible return type |
| 10 | |
| 11 | # Calling with wrong argument types |
| 12 | def complex_function( |
| 13 | callback: Callable[[Dict[str, List[int]], Optional[str]], bool], |
| 14 | items: List[Dict[str, Union[int, str, float, bool, None]]] |
| 15 | ) -> None: |
| 16 | pass |
| 17 | |
| 18 | complex_function("not a callback", 123) # Multiple type errors |
| 19 | |
| 20 | # Undefined variable with suggestion |
| 21 | very_long_variable_name_that_might_be_misspelled = 42 |
| 22 | print(very_long_variabel_name_that_might_be_mispelled) # Typo - long suggestion |
| 23 | |
| 24 | # Missing required arguments |
| 25 | def function_with_many_required_params( |
| 26 | first_required_param: str, |
| 27 | second_required_param: int, |
| 28 | third_required_param: float, |
| 29 | fourth_required_param: bool, |
| 30 | fifth_required_param: List[str] |
| 31 | ) -> None: |
| 32 | pass |
| 33 | |
| 34 | function_with_many_required_params() # Missing all required arguments |
| 35 | |
| 36 | # Incompatible override |
| 37 | class BaseClassWithLongMethodSignature: |
| 38 | def very_descriptive_method_name_for_processing_data( |
| 39 | self, |
| 40 | input_data: Dict[str, List[int]], |
| 41 | configuration: Optional[Dict[str, str]] = None |
| 42 | ) -> List[Dict[str, Union[int, str]]]: |
| 43 | return [] |
| 44 | |
| 45 | class DerivedClass(BaseClassWithLongMethodSignature): |
| 46 | def very_descriptive_method_name_for_processing_data( |
| 47 | self, |
| 48 | input_data: str # Wrong signature |
| 49 | ) -> int: |
| 50 | return 0 |