Fixed #4475 -- Fixed a problem that was preventing streaming tests for the

serializers from ever being run. Based on a patch from ian.g.kelly@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5453 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-06-10 03:06:34 +00:00
parent 1b02534ac3
commit a33fb695e3
2 changed files with 10 additions and 8 deletions

View File

@ -130,6 +130,7 @@ answer newbie questions, and generally made Django that much better:
junzhang.jn@gmail.com junzhang.jn@gmail.com
Antti Kaihola <http://akaihola.blogspot.com/> Antti Kaihola <http://akaihola.blogspot.com/>
Ben Dean Kawamura <ben.dean.kawamura@gmail.com> Ben Dean Kawamura <ben.dean.kawamura@gmail.com>
ian.g.kelly@gmail.com
Garth Kidd <http://www.deadlybloodyserious.com/> Garth Kidd <http://www.deadlybloodyserious.com/>
kilian <kilian.cavalotti@lip6.fr> kilian <kilian.cavalotti@lip6.fr>
Sune Kirkeby <http://ibofobi.dk/> Sune Kirkeby <http://ibofobi.dk/>

View File

@ -310,10 +310,11 @@ def streamTest(format, self):
string_data = serializers.serialize(format, [obj], indent=2) string_data = serializers.serialize(format, [obj], indent=2)
# Check that the two are the same # Check that the two are the same
self.assertEqual(string_data, stream.buffer()) self.assertEqual(string_data, stream.getvalue())
stream.close() stream.close()
for format in serializers.get_serializer_formats(): for format in serializers.get_serializer_formats():
setattr(SerializerTests, 'test_'+format+'_serializer', curry(serializerTest, format)) setattr(SerializerTests, 'test_'+format+'_serializer', curry(serializerTest, format))
setattr(SerializerTests, 'test_'+format+'_serializer_fields', curry(fieldsTest, 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))