Ticket #14159: django-abspath.diff

File django-abspath.diff, 2.6 KB (added by Alex Gaynor, 14 years ago)
  • tests/regressiontests/forms/fields.py

    diff --git a/tests/regressiontests/forms/fields.py b/tests/regressiontests/forms/fields.py
    index 990a9f7..e4f2c26 100644
    a b class FieldsTests(TestCase):  
    766766    # FilePathField ###############################################################
    767767
    768768    def test_filepathfield_65(self):
    769         path = forms.__file__
     769        path = os.path.abspath(forms.__file__)
    770770        path = os.path.dirname(path) + '/'
    771         assert fix_os_paths(path).endswith('/django/forms/')
     771        self.assertTrue(fix_os_paths(path).endswith('/django/forms/'))
    772772
    773773    def test_filepathfield_66(self):
    774774        path = forms.__file__
    775         path = os.path.dirname(path) + '/'
     775        path = os.path.dirname(os.path.abspath(path)) + '/'
    776776        f = FilePathField(path=path)
    777777        f.choices = [p for p in f.choices if p[0].endswith('.py')]
    778778        f.choices.sort()
    class FieldsTests(TestCase):  
    787787            ]
    788788        for exp, got in zip(expected, fix_os_paths(f.choices)):
    789789            self.assertEqual(exp[1], got[1])
    790             assert got[0].endswith(exp[0])
     790            self.assertTrue(got[0].endswith(exp[0]))
    791791        self.assertRaisesErrorWithMessage(ValidationError, "[u'Select a valid choice. fields.py is not one of the available choices.']", f.clean, 'fields.py')
    792792        assert fix_os_paths(f.clean(path + 'fields.py')).endswith('/django/forms/fields.py')
    793793
    794794    def test_filepathfield_67(self):
    795795        path = forms.__file__
    796         path = os.path.dirname(path) + '/'
     796        path = os.path.dirname(os.path.abspath(path)) + '/'
    797797        f = FilePathField(path=path, match='^.*?\.py$')
    798798        f.choices.sort()
    799799        expected = [
    class FieldsTests(TestCase):  
    807807            ]
    808808        for exp, got in zip(expected, fix_os_paths(f.choices)):
    809809            self.assertEqual(exp[1], got[1])
    810             assert got[0].endswith(exp[0])
     810            self.assertTrue(got[0].endswith(exp[0]))
    811811
    812812    def test_filepathfield_68(self):
    813         path = forms.__file__
     813        path = os.path.abspath(forms.__file__)
    814814        path = os.path.dirname(path) + '/'
    815815        f = FilePathField(path=path, recursive=True, match='^.*?\.py$')
    816816        f.choices.sort()
    class FieldsTests(TestCase):  
    827827            ]
    828828        for exp, got in zip(expected, fix_os_paths(f.choices)):
    829829            self.assertEqual(exp[1], got[1])
    830             assert got[0].endswith(exp[0])
     830            self.assertTrue(got[0].endswith(exp[0]))
    831831
    832832    # SplitDateTimeField ##########################################################
    833833
Back to Top