summaryrefslogtreecommitdiff
path: root/tests/regressiontests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-06-11 14:51:26 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-06-11 14:51:26 +0000
commit748ea65a6180293c356faa3ff0e754cb1d678d14 (patch)
tree542a590e521cfd639d1903a4968e75edd68e039d /tests/regressiontests
parent0b4122d1387e3c793661c0828278a021364691d4 (diff)
unicode: Merged changes from trunk up to [5460].
git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5462 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
-rw-r--r--tests/regressiontests/serializers_regress/tests.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/regressiontests/serializers_regress/tests.py b/tests/regressiontests/serializers_regress/tests.py
index e20bbbd363..4afd87ccc8 100644
--- a/tests/regressiontests/serializers_regress/tests.py
+++ b/tests/regressiontests/serializers_regress/tests.py
@@ -288,11 +288,11 @@ def fieldsTest(format, self):
obj = ComplexModel(field1='first',field2='second',field3='third')
obj.save()
-
+
# Serialize then deserialize the test database
serialized_data = serializers.serialize(format, [obj], indent=2, fields=('field1','field3'))
result = serializers.deserialize(format, serialized_data).next()
-
+
# Check that the deserialized object contains data in only the serialized fields.
self.assertEqual(result.object.field1, 'first')
self.assertEqual(result.object.field2, '')
@@ -304,19 +304,20 @@ def streamTest(format, self):
obj = ComplexModel(field1='first',field2='second',field3='third')
obj.save()
-
+
# Serialize the test database to a stream
- stream = StringIO()
+ stream = StringIO()
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
- self.assertEqual(string_data, stream.buffer())
+ self.assertEqual(string_data, stream.getvalue())
stream.close()
-
+
for format in serializers.get_serializer_formats():
setattr(SerializerTests, 'test_'+format+'_serializer', curry(serializerTest, format))
setattr(SerializerTests, 'test_'+format+'_serializer_fields', curry(fieldsTest, format))
- setattr(SerializerTests, 'test_'+format+'_serializer_stream', curry(fieldsTest, format))
+ if format != 'python':
+ setattr(SerializerTests, 'test_'+format+'_serializer_stream', curry(streamTest, format))