From 23e886886249ebe8f80a48b0d25fbb5308eeb06f Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Wed, 18 Jan 2023 19:11:18 +0100 Subject: Refs #34233 -- Used str.removeprefix()/removesuffix(). --- tests/forms_tests/field_tests/test_filepathfield.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'tests/forms_tests') diff --git a/tests/forms_tests/field_tests/test_filepathfield.py b/tests/forms_tests/field_tests/test_filepathfield.py index ca0f6f3a7a..092001b453 100644 --- a/tests/forms_tests/field_tests/test_filepathfield.py +++ b/tests/forms_tests/field_tests/test_filepathfield.py @@ -9,9 +9,7 @@ PATH = os.path.dirname(os.path.abspath(__file__)) def fix_os_paths(x): if isinstance(x, str): - if x.startswith(PATH): - x = x[len(PATH) :] - return x.replace("\\", "/") + return x.removeprefix(PATH).replace("\\", "/") elif isinstance(x, tuple): return tuple(fix_os_paths(list(x))) elif isinstance(x, list): -- cgit v1.3