Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…tchelder.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7355 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 622a6447f90b967a0b500057f6292e5f83b86332 1 parent 9915004
Malcolm Tredinnick authored March 24, 2008

Showing 1 changed file with 15 additions and 5 deletions. Show diff stats Hide diff stats

  1. 20  tests/regressiontests/forms/fields.py
20  tests/regressiontests/forms/fields.py
@@ -1135,29 +1135,39 @@
1135 1135
 
1136 1136
 # FilePathField ###############################################################
1137 1137
 
  1138
+>>> def fix_os_paths(x):
  1139
+...     if isinstance(x, basestring):
  1140
+...         return x.replace('\\', '/')
  1141
+...     elif isinstance(x, tuple):
  1142
+...         return tuple(fix_os_paths(list(x)))
  1143
+...     elif isinstance(x, list):
  1144
+...         return [fix_os_paths(y) for y in x]
  1145
+...     else:
  1146
+...         return x
  1147
+...
1138 1148
 >>> import os
1139 1149
 >>> from django import newforms as forms
1140 1150
 >>> path = forms.__file__
1141 1151
 >>> path = os.path.dirname(path) + '/'
1142  
->>> path
  1152
+>>> fix_os_paths(path)
1143 1153
 '.../django/newforms/'
1144 1154
 >>> f = forms.FilePathField(path=path)
1145 1155
 >>> f.choices.sort()
1146  
->>> f.choices
  1156
+>>> fix_os_paths(f.choices)
1147 1157
 [('.../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')]
1148 1158
 >>> f.clean('fields.py')
1149 1159
 Traceback (most recent call last):
1150 1160
 ...
1151 1161
 ValidationError: [u'Select a valid choice. That choice is not one of the available choices.']
1152  
->>> f.clean(path + 'fields.py')
  1162
+>>> fix_os_paths(f.clean(path + 'fields.py'))
1153 1163
 u'.../django/newforms/fields.py'
1154 1164
 >>> f = forms.FilePathField(path=path, match='^.*?\.py$')
1155 1165
 >>> f.choices.sort()
1156  
->>> f.choices
  1166
+>>> fix_os_paths(f.choices)
1157 1167
 [('.../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')]
1158 1168
 >>> f = forms.FilePathField(path=path, recursive=True, match='^.*?\.py$')
1159 1169
 >>> f.choices.sort()
1160  
->>> f.choices
  1170
+>>> fix_os_paths(f.choices)
1161 1171
 [('.../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')]
1162 1172
 
1163 1173
 # SplitDateTimeField ##########################################################

0 notes on commit 622a644

Please sign in to comment.
Something went wrong with that request. Please try again.