summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-03-23 14:21:14 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-03-23 14:21:14 +0000
commit6e60c8b7c00ff29a6434a66af7522f438e92fd58 (patch)
treeecfef2a0a367ba759846177dcc268bc1c51b1853 /tests
parent752856530f94cd3579813d6474020459cc80730a (diff)
[1.1.X] Fixed #13171 -- Corrected the field_subclassing unit test. Thanks to Gabriel Hurley for the report and patch.
Backport of r12838 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12839 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/modeltests/field_subclassing/fields.py10
-rw-r--r--tests/modeltests/field_subclassing/models.py2
2 files changed, 6 insertions, 6 deletions
diff --git a/tests/modeltests/field_subclassing/fields.py b/tests/modeltests/field_subclassing/fields.py
index d545b1968d..42c963566b 100644
--- a/tests/modeltests/field_subclassing/fields.py
+++ b/tests/modeltests/field_subclassing/fields.py
@@ -48,23 +48,23 @@ class SmallField(models.Field):
return [force_unicode(v) for v in value]
if lookup_type == 'isnull':
return []
- raise FieldError('Invalid lookup type: %r' % lookup_type)
+ raise TypeError('Invalid lookup type: %r' % lookup_type)
class JSONField(models.TextField):
__metaclass__ = models.SubfieldBase
-
+
description = ("JSONField automatically serializes and desializes values to "
"and from JSON.")
-
+
def to_python(self, value):
if not value:
return None
-
+
if isinstance(value, basestring):
value = json.loads(value)
return value
-
+
def get_db_prep_save(self, value):
if value is None:
return None
diff --git a/tests/modeltests/field_subclassing/models.py b/tests/modeltests/field_subclassing/models.py
index 93b30c2ec2..a9fe88fe77 100644
--- a/tests/modeltests/field_subclassing/models.py
+++ b/tests/modeltests/field_subclassing/models.py
@@ -51,7 +51,7 @@ True
>>> MyModel.objects.filter(data__lt=s)
Traceback (most recent call last):
...
-FieldError: Invalid lookup type: 'lt'
+TypeError: Invalid lookup type: 'lt'
# Serialization works, too.
>>> stream = serializers.serialize("json", MyModel.objects.all())