Author: gwilson
Date: 2007-11-25 12:16:40 -0600 (Sun, 25 Nov 2007)
New Revision: 6715
Modified:
django/trunk/tests/regressiontests/datastructures/tests.py
Log:
Added a few more tests for `MultiValueDict`.
Modified: django/trunk/tests/regressiontests/datastructures/tests.py
===================================================================
--- django/trunk/tests/regressiontests/datastructures/tests.py 2007-11-25
18:14:18 UTC (rev 6714)
+++ django/trunk/tests/regressiontests/datastructures/tests.py 2007-11-25
18:16:40 UTC (rev 6715)
@@ -25,11 +25,23 @@
>>> d = MultiValueDict({'name': ['Adrian', 'Simon'], 'position':
>>> ['Developer']})
>>> d['name']
'Simon'
+>>> d.get('name')
+'Simon'
>>> d.getlist('name')
['Adrian', 'Simon']
+>>> d['lastname']
+Traceback (most recent call last):
+...
+MultiValueDictKeyError: "Key 'lastname' not found in <MultiValueDict:
{'position': ['Developer'], 'name': ['Adrian', 'Simon']}>"
+>>> d.get('lastname')
+
>>> d.get('lastname', 'nonexistent')
'nonexistent'
+>>> d.getlist('lastname')
+[]
>>> d.setlist('lastname', ['Holovaty', 'Willison'])
+>>> d.getlist('lastname')
+['Holovaty', 'Willison']
### SortedDict
#################################################################
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---