diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-12-08 11:13:52 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-12-08 11:13:52 +0100 |
| commit | c91667338a4e774e2819ccf4da852dc7b759bc19 (patch) | |
| tree | 42a700d237c85ac2b647999d02d3dcd7d8047068 /tests/regressiontests/forms | |
| parent | 53b879f045f0e55cc8f4bedff67b5a14f3057561 (diff) | |
Fixed #19357 -- Allow non-ASCII chars in filesystem paths
Thanks kujiu for the report and Aymeric Augustin for the review.
Diffstat (limited to 'tests/regressiontests/forms')
| -rw-r--r-- | tests/regressiontests/forms/tests/fields.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/regressiontests/forms/tests/fields.py b/tests/regressiontests/forms/tests/fields.py index 1027afceb1..e17d976fcf 100644 --- a/tests/regressiontests/forms/tests/fields.py +++ b/tests/regressiontests/forms/tests/fields.py @@ -36,6 +36,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile from django.forms import * from django.test import SimpleTestCase from django.utils import six +from django.utils._os import upath def fix_os_paths(x): @@ -928,12 +929,12 @@ class FieldsTests(SimpleTestCase): # FilePathField ############################################################### def test_filepathfield_1(self): - path = os.path.abspath(forms.__file__) + path = os.path.abspath(upath(forms.__file__)) path = os.path.dirname(path) + '/' self.assertTrue(fix_os_paths(path).endswith('/django/forms/')) def test_filepathfield_2(self): - path = forms.__file__ + path = upath(forms.__file__) path = os.path.dirname(os.path.abspath(path)) + '/' f = FilePathField(path=path) f.choices = [p for p in f.choices if p[0].endswith('.py')] @@ -954,7 +955,7 @@ class FieldsTests(SimpleTestCase): assert fix_os_paths(f.clean(path + 'fields.py')).endswith('/django/forms/fields.py') def test_filepathfield_3(self): - path = forms.__file__ + path = upath(forms.__file__) path = os.path.dirname(os.path.abspath(path)) + '/' f = FilePathField(path=path, match='^.*?\.py$') f.choices.sort() @@ -972,7 +973,7 @@ class FieldsTests(SimpleTestCase): self.assertTrue(got[0].endswith(exp[0])) def test_filepathfield_4(self): - path = os.path.abspath(forms.__file__) + path = os.path.abspath(upath(forms.__file__)) path = os.path.dirname(path) + '/' f = FilePathField(path=path, recursive=True, match='^.*?\.py$') f.choices.sort() @@ -992,7 +993,7 @@ class FieldsTests(SimpleTestCase): self.assertTrue(got[0].endswith(exp[0])) def test_filepathfield_folders(self): - path = os.path.dirname(__file__) + '/filepath_test_files/' + path = os.path.dirname(upath(__file__)) + '/filepath_test_files/' f = FilePathField(path=path, allow_folders=True, allow_files=False) f.choices.sort() expected = [ |
