summaryrefslogtreecommitdiff
path: root/tests/forms_tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-01-18 19:11:18 +0100
committerGitHub <noreply@github.com>2023-01-18 19:11:18 +0100
commit23e886886249ebe8f80a48b0d25fbb5308eeb06f (patch)
treeddd2eb220750704fa4fbfd8447654fc3d382bd10 /tests/forms_tests
parentfd21f82aa82b0d75a161f618ef944ebe0923e0ab (diff)
downloaddjango-23e886886249ebe8f80a48b0d25fbb5308eeb06f.tar.gz
Refs #34233 -- Used str.removeprefix()/removesuffix().
Diffstat (limited to 'tests/forms_tests')
-rw-r--r--tests/forms_tests/field_tests/test_filepathfield.py4
1 files changed, 1 insertions, 3 deletions
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):