@@ -374,42 +374,35 @@ def add(self, test_file: TestFile) -> None:
374374
375375 def get_by_original_file_path (self , file_path : Path ) -> TestFile | None :
376376 normalized = self ._normalize_path_for_comparison (file_path )
377- return next (
378- (
379- test_file
380- for test_file in self .test_files
381- if test_file .original_file_path is not None
382- and normalized == self ._normalize_path_for_comparison (test_file .original_file_path )
383- ),
384- None ,
385- )
377+ for test_file in self .test_files :
378+ if test_file .original_file_path is None :
379+ continue
380+ normalized_test_path = self ._normalize_path_for_comparison (test_file .original_file_path )
381+ if normalized == normalized_test_path :
382+ return test_file
383+ return None
386384
387385 def get_test_type_by_instrumented_file_path (self , file_path : Path ) -> TestType | None :
388386 normalized = self ._normalize_path_for_comparison (file_path )
389- return next (
390- (
391- test_file .test_type
392- for test_file in self .test_files
393- if normalized == self ._normalize_path_for_comparison (test_file .instrumented_behavior_file_path )
394- or (
395- test_file .benchmarking_file_path is not None
396- and normalized == self ._normalize_path_for_comparison (test_file .benchmarking_file_path )
397- )
398- ),
399- None ,
400- )
387+ for test_file in self .test_files :
388+ normalized_behavior_path = self ._normalize_path_for_comparison (test_file .instrumented_behavior_file_path )
389+ if normalized == normalized_behavior_path :
390+ return test_file .test_type
391+ if test_file .benchmarking_file_path is not None :
392+ normalized_benchmark_path = self ._normalize_path_for_comparison (test_file .benchmarking_file_path )
393+ if normalized == normalized_benchmark_path :
394+ return test_file .test_type
395+ return None
401396
402397 def get_test_type_by_original_file_path (self , file_path : Path ) -> TestType | None :
403398 normalized = self ._normalize_path_for_comparison (file_path )
404- return next (
405- (
406- test_file .test_type
407- for test_file in self .test_files
408- if test_file .original_file_path is not None
409- and normalized == self ._normalize_path_for_comparison (test_file .original_file_path )
410- ),
411- None ,
412- )
399+ for test_file in self .test_files :
400+ if test_file .original_file_path is None :
401+ continue
402+ normalized_test_path = self ._normalize_path_for_comparison (test_file .original_file_path )
403+ if normalized == normalized_test_path :
404+ return test_file .test_type
405+ return None
413406
414407 @staticmethod
415408 @lru_cache (maxsize = 4096 )
0 commit comments