aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests/serializer.py
diff options
context:
space:
mode:
authorgarciasolero2011-07-13 14:12:34 +0200
committergarciasolero2011-07-13 14:12:34 +0200
commitcc7a77c477e39a1a9010406110017270c05ebaf2 (patch)
treeea60733ddd066a0ba9b9c5a1f20dfb800f79e98a /djangorestframework/tests/serializer.py
parent39d9ac9d1ba8635629891f3fb7d4ed7a134c984c (diff)
downloaddjango-rest-framework-cc7a77c477e39a1a9010406110017270c05ebaf2.tar.bz2
Test for serialitation of dictionaries with keys that collide with
dictionary method names
Diffstat (limited to 'djangorestframework/tests/serializer.py')
-rw-r--r--djangorestframework/tests/serializer.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/djangorestframework/tests/serializer.py b/djangorestframework/tests/serializer.py
index 9f629050..fff72c02 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):
"""