Author: ikelly
Date: 2011-09-30 14:40:56 -0700 (Fri, 30 Sep 2011)
New Revision: 16919
Modified:
django/trunk/tests/modeltests/model_forms/tests.py
Log:
Fixed #16645: fixed a broken test to work in Oracle.
Modified: django/trunk/tests/modeltests/model_forms/tests.py
===================================================================
--- django/trunk/tests/modeltests/model_forms/tests.py 2011-09-30 20:53:39 UTC
(rev 16918)
+++ django/trunk/tests/modeltests/model_forms/tests.py 2011-09-30 21:40:56 UTC
(rev 16919)
@@ -8,6 +8,7 @@
from django.test import TestCase
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.validators import ValidationError
+from django.db import connection
from django.forms.models import model_to_dict
from django.utils.unittest import skipUnless
@@ -1313,11 +1314,17 @@
instance.delete()
# Test the non-required ImageField
+ # Note: In Oracle, we expect a null ImageField to return u'' instead of
+ # None.
+ if connection.features.interprets_empty_strings_as_nulls:
+ expected_null_imagefield_repr = u''
+ else:
+ expected_null_imagefield_repr = None
f = OptionalImageFileForm(data={'description': u'Test'})
self.assertEqual(f.is_valid(), True)
instance = f.save()
- self.assertEqual(instance.image.name, None)
+ self.assertEqual(instance.image.name, expected_null_imagefield_repr)
self.assertEqual(instance.width, None)
self.assertEqual(instance.height, None)
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.