summaryrefslogtreecommitdiff
path: root/tests/regressiontests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-08-14 19:48:38 +0200
committerClaude Paroz <claude@2xlibre.net>2012-08-14 19:54:53 +0200
commitf2fe7a3e36bebb529f33f5b702b7643a3db85c72 (patch)
tree58c19f611533b66d7925459ef9d8db299eacc107 /tests/regressiontests
parent7d48e077b573afb4184301be6565a88e8a9b6e28 (diff)
[py3] Fixed serializers tests
Diffstat (limited to 'tests/regressiontests')
-rw-r--r--tests/regressiontests/serializers_regress/tests.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/regressiontests/serializers_regress/tests.py b/tests/regressiontests/serializers_regress/tests.py
index 4e73be015c..f4b3adaa5e 100644
--- a/tests/regressiontests/serializers_regress/tests.py
+++ b/tests/regressiontests/serializers_regress/tests.py
@@ -10,7 +10,6 @@ from __future__ import absolute_import, unicode_literals
import datetime
import decimal
-from io import BytesIO
try:
import yaml
@@ -23,6 +22,7 @@ from django.core.serializers.base import DeserializationError
from django.db import connection, models
from django.http import HttpResponse
from django.test import TestCase
+from django.utils import six
from django.utils.functional import curry
from django.utils.unittest import skipUnless
@@ -502,17 +502,17 @@ def streamTest(format, self):
obj.save_base(raw=True)
# Serialize the test database to a stream
- for stream in (BytesIO(), HttpResponse()):
+ for stream in (six.StringIO(), HttpResponse()):
serializers.serialize(format, [obj], indent=2, stream=stream)
# Serialize normally for a comparison
string_data = serializers.serialize(format, [obj], indent=2)
# Check that the two are the same
- if isinstance(stream, BytesIO):
+ if isinstance(stream, six.StringIO):
self.assertEqual(string_data, stream.getvalue())
else:
- self.assertEqual(string_data, stream.content)
+ self.assertEqual(string_data, stream.content.decode('utf-8'))
stream.close()
for format in serializers.get_serializer_formats():