From 6c70b082f32f4bcf47a7f6e3578b385afdf35ef2 Mon Sep 17 00:00:00 2001 From: zzj <29055749+zjzh@users.noreply.github.com> Date: Thu, 20 Jan 2022 23:49:10 +0800 Subject: [PATCH] refactoring code with List Comprehension refactoring code with List Comprehension which is more pythonic, concise and efficient --- tests/tester.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/tester.py b/tests/tester.py index 8dbe402..e39f9f1 100755 --- a/tests/tester.py +++ b/tests/tester.py @@ -32,11 +32,8 @@ def test_ko(self): self.report_test_case(file, expected_errors == found_errors) def input_files_in(self, path): - input_files = [] - for root, dirs, files in os.walk(path): - for file in files: - if file.endswith(".pbxproj"): - input_files.append(path + file) + input_files = [path + file for (root, dirs, files) in os.walk(path) + for file in files if file.endswith('.pbxproj')] return input_files def report_test_case(self, path, passed):