From cc7a77c477e39a1a9010406110017270c05ebaf2 Mon Sep 17 00:00:00 2001 From: garciasolero Date: Wed, 13 Jul 2011 14:12:34 +0200 Subject: [PATCH] Test for serialitation of dictionaries with keys that collide with dictionary method names --- djangorestframework/tests/serializer.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/djangorestframework/tests/serializer.py b/djangorestframework/tests/serializer.py index 9f6290502..fff72c024 100644 --- a/djangorestframework/tests/serializer.py +++ b/djangorestframework/tests/serializer.py @@ -40,6 +40,12 @@ class TestObjectToData(TestCase): now = datetime.datetime.now() self.assertEquals(self.serialize(now), now) + def test_dict_method_name_collision(self): + """dict with key that collides with dict method name""" + self.assertEquals(self.serialize({'items': 'foo'}), {'items': u'foo'}) + self.assertEquals(self.serialize({'keys': 'foo'}), {'keys': u'foo'}) + self.assertEquals(self.serialize({'values': 'foo'}), {'values': u'foo'}) + class TestFieldNesting(TestCase): """