~ubuntu-branches/ubuntu/quantal/python-django/quantal-security

« back to all changes in this revision

Viewing changes to tests/regressiontests/forms/fields.py

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2010-10-12 11:34:35 UTC
  • mfrom: (1.2.7 upstream)
  • mto: This revision was merged to the branch mainline in revision 30.
  • Revision ID: james.westby@ubuntu.com-20101012113435-9lnsrh0i3mxozbt0
Tags: upstream-1.2.3
ImportĀ upstreamĀ versionĀ 1.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
766
766
    # FilePathField ###############################################################
767
767
 
768
768
    def test_filepathfield_65(self):
769
 
        path = forms.__file__
 
769
        path = os.path.abspath(forms.__file__)
770
770
        path = os.path.dirname(path) + '/'
771
 
        assert fix_os_paths(path).endswith('/django/forms/')
 
771
        self.assertTrue(fix_os_paths(path).endswith('/django/forms/'))
772
772
 
773
773
    def test_filepathfield_66(self):
774
774
        path = forms.__file__
775
 
        path = os.path.dirname(path) + '/'
 
775
        path = os.path.dirname(os.path.abspath(path)) + '/'
776
776
        f = FilePathField(path=path)
777
777
        f.choices = [p for p in f.choices if p[0].endswith('.py')]
778
778
        f.choices.sort()
787
787
            ]
788
788
        for exp, got in zip(expected, fix_os_paths(f.choices)):
789
789
            self.assertEqual(exp[1], got[1])
790
 
            assert got[0].endswith(exp[0])
 
790
            self.assertTrue(got[0].endswith(exp[0]))
791
791
        self.assertRaisesErrorWithMessage(ValidationError, "[u'Select a valid choice. fields.py is not one of the available choices.']", f.clean, 'fields.py')
792
792
        assert fix_os_paths(f.clean(path + 'fields.py')).endswith('/django/forms/fields.py')
793
793
 
794
794
    def test_filepathfield_67(self):
795
795
        path = forms.__file__
796
 
        path = os.path.dirname(path) + '/'
 
796
        path = os.path.dirname(os.path.abspath(path)) + '/'
797
797
        f = FilePathField(path=path, match='^.*?\.py$')
798
798
        f.choices.sort()
799
799
        expected = [
807
807
            ]
808
808
        for exp, got in zip(expected, fix_os_paths(f.choices)):
809
809
            self.assertEqual(exp[1], got[1])
810
 
            assert got[0].endswith(exp[0])
 
810
            self.assertTrue(got[0].endswith(exp[0]))
811
811
 
812
812
    def test_filepathfield_68(self):
813
 
        path = forms.__file__
 
813
        path = os.path.abspath(forms.__file__)
814
814
        path = os.path.dirname(path) + '/'
815
815
        f = FilePathField(path=path, recursive=True, match='^.*?\.py$')
816
816
        f.choices.sort()
827
827
            ]
828
828
        for exp, got in zip(expected, fix_os_paths(f.choices)):
829
829
            self.assertEqual(exp[1], got[1])
830
 
            assert got[0].endswith(exp[0])
 
830
            self.assertTrue(got[0].endswith(exp[0]))
831
831
 
832
832
    # SplitDateTimeField ##########################################################
833
833