summaryrefslogtreecommitdiff
path: root/tests/regressiontests/datastructures
diff options
context:
space:
mode:
authorGary Wilson Jr <gary.wilson@gmail.com>2007-11-25 18:16:40 +0000
committerGary Wilson Jr <gary.wilson@gmail.com>2007-11-25 18:16:40 +0000
commit5903b0bdcdf160d668a5c0e534b1a51feb71dc57 (patch)
treeaf39d6cd210584ebffbdd41ad4ca36cddcb84f76 /tests/regressiontests/datastructures
parentc7181ec0ff14fb1515f009114b6d99f8374a819e (diff)
Added a few more tests for `MultiValueDict`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6715 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/datastructures')
-rw-r--r--tests/regressiontests/datastructures/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/regressiontests/datastructures/tests.py b/tests/regressiontests/datastructures/tests.py
index d1e21e673c..3b0ccde257 100644
--- a/tests/regressiontests/datastructures/tests.py
+++ b/tests/regressiontests/datastructures/tests.py
@@ -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 #################################################################