Django

Code

Changeset 7355

Show
Ignore:
Timestamp:
03/24/08 08:10:48 (4 months ago)
Author:
mtredinnick
Message:

Fixed #6868 -- Fixed test results for Windows systems. Thanks, Ned Batchelder.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/regressiontests/forms/fields.py

    r7323 r7355  
    11371137# FilePathField ############################################################### 
    11381138 
     1139>>> def fix_os_paths(x): 
     1140...     if isinstance(x, basestring): 
     1141...         return x.replace('\\', '/') 
     1142...     elif isinstance(x, tuple): 
     1143...         return tuple(fix_os_paths(list(x))) 
     1144...     elif isinstance(x, list): 
     1145...         return [fix_os_paths(y) for y in x] 
     1146...     else: 
     1147...         return x 
     1148... 
    11391149>>> import os 
    11401150>>> from django import newforms as forms 
    11411151>>> path = forms.__file__ 
    11421152>>> path = os.path.dirname(path) + '/' 
    1143 >>> path 
     1153>>> fix_os_paths(path) 
    11441154'.../django/newforms/' 
    11451155>>> f = forms.FilePathField(path=path) 
    11461156>>> f.choices.sort() 
    1147 >>> f.choices 
     1157>>> fix_os_paths(f.choices) 
    11481158[('.../django/newforms/__init__.py', '__init__.py'), ('.../django/newforms/__init__.pyc', '__init__.pyc'), ('.../django/newforms/fields.py', 'fields.py'), ('.../django/newforms/fields.pyc', 'fields.pyc'), ('.../django/newforms/forms.py', 'forms.py'), ('.../django/newforms/forms.pyc', 'forms.pyc'), ('.../django/newforms/models.py', 'models.py'), ('.../django/newforms/models.pyc', 'models.pyc'), ('.../django/newforms/util.py', 'util.py'), ('.../django/newforms/util.pyc', 'util.pyc'), ('.../django/newforms/widgets.py', 'widgets.py'), ('.../django/newforms/widgets.pyc', 'widgets.pyc')] 
    11491159>>> f.clean('fields.py') 
     
    11511161... 
    11521162ValidationError: [u'Select a valid choice. That choice is not one of the available choices.'] 
    1153 >>> f.clean(path + 'fields.py'
     1163>>> fix_os_paths(f.clean(path + 'fields.py')
    11541164u'.../django/newforms/fields.py' 
    11551165>>> f = forms.FilePathField(path=path, match='^.*?\.py$') 
    11561166>>> f.choices.sort() 
    1157 >>> f.choices 
     1167>>> fix_os_paths(f.choices) 
    11581168[('.../django/newforms/__init__.py', '__init__.py'), ('.../django/newforms/fields.py', 'fields.py'), ('.../django/newforms/forms.py', 'forms.py'), ('.../django/newforms/models.py', 'models.py'), ('.../django/newforms/util.py', 'util.py'), ('.../django/newforms/widgets.py', 'widgets.py')] 
    11591169>>> f = forms.FilePathField(path=path, recursive=True, match='^.*?\.py$') 
    11601170>>> f.choices.sort() 
    1161 >>> f.choices 
     1171>>> fix_os_paths(f.choices) 
    11621172[('.../django/newforms/__init__.py', '__init__.py'), ('.../django/newforms/extras/__init__.py', 'extras/__init__.py'), ('.../django/newforms/extras/widgets.py', 'extras/widgets.py'), ('.../django/newforms/fields.py', 'fields.py'), ('.../django/newforms/forms.py', 'forms.py'), ('.../django/newforms/models.py', 'models.py'), ('.../django/newforms/util.py', 'util.py'), ('.../django/newforms/widgets.py', 'widgets.py')] 
    11631173