aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests/serializer.py
diff options
context:
space:
mode:
authorRyan Kaskel2013-05-18 14:31:29 +0100
committerRyan Kaskel2013-05-18 14:31:29 +0100
commitef383d969c440a20fdf25748de590e07cb1abfda (patch)
treec4535ead8a903cd77cefa148867452caacb1ac69 /rest_framework/tests/serializer.py
parent22874e441dd71101296a656e753bfc17907b5cca (diff)
downloaddjango-rest-framework-ef383d969c440a20fdf25748de590e07cb1abfda.tar.bz2
Clean up test case.
Diffstat (limited to 'rest_framework/tests/serializer.py')
-rw-r--r--rest_framework/tests/serializer.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/rest_framework/tests/serializer.py b/rest_framework/tests/serializer.py
index d978dc87..e999b624 100644
--- a/rest_framework/tests/serializer.py
+++ b/rest_framework/tests/serializer.py
@@ -1,8 +1,9 @@
from __future__ import unicode_literals
from django.db import models
from django.db.models.fields import BLANK_CHOICE_DASH
-from django.utils.datastructures import MultiValueDict
from django.test import TestCase
+from django.utils.datastructures import MultiValueDict
+from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from rest_framework.tests.models import (HasPositiveIntegerAsChoice, Album, ActionItem, Anchor, BasicModel,
BlankFieldModel, BlogPost, BlogPostComment, Book, CallableDefaultValueModel, DefaultValueModel,
@@ -1246,6 +1247,7 @@ class DeserializeListTestCase(TestCase):
# test for issue 747
+
class LazyStringModel(object):
def __init__(self, lazystring):
self.lazystring = lazystring
@@ -1258,16 +1260,14 @@ class LazyStringSerializer(serializers.Serializer):
if instance is not None:
instance.lazystring = attrs.get('lazystring', instance.lazystring)
return instance
- return Comment(**attrs)
+ return LazyStringModel(**attrs)
class LazyStringsTestCase(TestCase):
-
def setUp(self):
- from django.utils.translation import ugettext_lazy as _
-
- self.model = LazyStringModel(lazystring=_("lazystring"))
+ self.model = LazyStringModel(lazystring=_('lazystring'))
def test_lazy_strings_are_translated(self):
serializer = LazyStringSerializer(self.model)
- self.assertEqual(type(serializer.data['lazystring']), type("lazystring"))
+ self.assertEqual(type(serializer.data['lazystring']),
+ type('lazystring'))