summaryrefslogtreecommitdiff
path: root/tests/forms_tests/field_tests/test_filepathfield.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-01-20 08:01:02 -0500
committerGitHub <noreply@github.com>2017-01-20 08:01:02 -0500
commit4e729feaa647547f25debb1cb63dec989dc41a20 (patch)
tree7c7a38c5961bf4daf98a8cb47dc74c769563ffcf /tests/forms_tests/field_tests/test_filepathfield.py
parentec4c1d6717da7a9d09d5b3ce84cccac819bb592c (diff)
Refs #23919 -- Removed django.utils._os.upath()/npath()/abspathu() usage.
These functions do nothing on Python 3.
Diffstat (limited to 'tests/forms_tests/field_tests/test_filepathfield.py')
-rw-r--r--tests/forms_tests/field_tests/test_filepathfield.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/tests/forms_tests/field_tests/test_filepathfield.py b/tests/forms_tests/field_tests/test_filepathfield.py
index 71164b5b7a..cbdf97b4c2 100644
--- a/tests/forms_tests/field_tests/test_filepathfield.py
+++ b/tests/forms_tests/field_tests/test_filepathfield.py
@@ -2,7 +2,6 @@ import os.path
from django.forms import FilePathField, ValidationError, forms
from django.test import SimpleTestCase
-from django.utils._os import upath
def fix_os_paths(x):
@@ -19,13 +18,11 @@ def fix_os_paths(x):
class FilePathFieldTest(SimpleTestCase):
def test_filepathfield_1(self):
- path = os.path.abspath(upath(forms.__file__))
- path = os.path.dirname(path) + '/'
+ path = os.path.dirname(os.path.abspath(forms.__file__)) + '/'
self.assertTrue(fix_os_paths(path).endswith('/django/forms/'))
def test_filepathfield_2(self):
- path = upath(forms.__file__)
- path = os.path.dirname(os.path.abspath(path)) + '/'
+ path = os.path.dirname(os.path.abspath(forms.__file__)) + '/'
f = FilePathField(path=path)
f.choices = [p for p in f.choices if p[0].endswith('.py')]
f.choices.sort()
@@ -49,8 +46,7 @@ class FilePathFieldTest(SimpleTestCase):
self.assertTrue(fix_os_paths(f.clean(path + 'fields.py')).endswith('/django/forms/fields.py'))
def test_filepathfield_3(self):
- path = upath(forms.__file__)
- path = os.path.dirname(os.path.abspath(path)) + '/'
+ path = os.path.dirname(os.path.abspath(forms.__file__)) + '/'
f = FilePathField(path=path, match=r'^.*?\.py$')
f.choices.sort()
expected = [
@@ -69,8 +65,7 @@ class FilePathFieldTest(SimpleTestCase):
self.assertTrue(got[0].endswith(exp[0]))
def test_filepathfield_4(self):
- path = os.path.abspath(upath(forms.__file__))
- path = os.path.dirname(path) + '/'
+ path = os.path.dirname(os.path.abspath(forms.__file__)) + '/'
f = FilePathField(path=path, recursive=True, match=r'^.*?\.py$')
f.choices.sort()
expected = [
@@ -89,7 +84,7 @@ class FilePathFieldTest(SimpleTestCase):
self.assertTrue(got[0].endswith(exp[0]))
def test_filepathfield_folders(self):
- path = os.path.abspath(os.path.join(upath(__file__), '..', '..')) + '/tests/filepath_test_files/'
+ path = os.path.abspath(os.path.join(__file__, '..', '..')) + '/tests/filepath_test_files/'
f = FilePathField(path=path, allow_folders=True, allow_files=False)
f.choices.sort()
expected = [