diff options
| author | Justin Bronn <jbronn@gmail.com> | 2007-08-26 01:10:53 +0000 |
|---|---|---|
| committer | Justin Bronn <jbronn@gmail.com> | 2007-08-26 01:10:53 +0000 |
| commit | 2052b508eb92c62fc0678efd4936c5ec1e0e735b (patch) | |
| tree | e510109b74b28c8ccef5f6955727cb9dce3da655 /tests/regressiontests/httpwrappers/tests.py | |
| parent | a7297a255f4bb86f608ea251e00253d18c31d9d4 (diff) | |
gis: Made necessary modifications for unicode, manage refactor, backend refactor and merged 5584-6000 via svnmerge from [repos:django/trunk trunk].
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@6018 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/httpwrappers/tests.py')
| -rw-r--r-- | tests/regressiontests/httpwrappers/tests.py | 76 |
1 files changed, 43 insertions, 33 deletions
diff --git a/tests/regressiontests/httpwrappers/tests.py b/tests/regressiontests/httpwrappers/tests.py index e7245104e9..9d5ca2006a 100644 --- a/tests/regressiontests/httpwrappers/tests.py +++ b/tests/regressiontests/httpwrappers/tests.py @@ -94,7 +94,7 @@ MultiValueDictKeyError: "Key 'foo' not found in <MultiValueDict: {}>" >>> q['name'] = 'john' >>> q['name'] -'john' +u'john' >>> del q['name'] >>> 'name' in q @@ -106,10 +106,10 @@ False 'default' >>> q.get('name', 'default') -'john' +u'john' >>> q.getlist('name') -['john'] +[u'john'] >>> q.getlist('foo') [] @@ -117,18 +117,18 @@ False >>> q.setlist('foo', ['bar', 'baz']) >>> q.get('foo', 'default') -'baz' +u'baz' >>> q.getlist('foo') -['bar', 'baz'] +[u'bar', u'baz'] >>> q.appendlist('foo', 'another') >>> q.getlist('foo') -['bar', 'baz', 'another'] +[u'bar', u'baz', u'another'] >>> q['foo'] -'another' +u'another' >>> q.has_key('foo') True @@ -137,16 +137,16 @@ True True >>> q.items() -[('foo', 'another'), ('name', 'john')] +[(u'foo', u'another'), (u'name', u'john')] >>> q.lists() -[('foo', ['bar', 'baz', 'another']), ('name', ['john'])] +[(u'foo', [u'bar', u'baz', u'another']), (u'name', [u'john'])] >>> q.keys() -['foo', 'name'] +[u'foo', u'name'] >>> q.values() -['another', 'john'] +[u'another', u'john'] >>> len(q) 2 @@ -155,16 +155,16 @@ True # Displays last value >>> q['foo'] -'hello' +u'hello' >>> q.get('foo', 'not available') -'hello' +u'hello' >>> q.getlist('foo') -['bar', 'baz', 'another', 'hello'] +[u'bar', u'baz', u'another', u'hello'] >>> q.pop('foo') -['bar', 'baz', 'another', 'hello'] +[u'bar', u'baz', u'another', u'hello'] >>> q.pop('foo', 'not there') 'not there' @@ -173,13 +173,13 @@ True 'not there' >>> q.setdefault('foo', 'bar') -'bar' +u'bar' >>> q['foo'] -'bar' +u'bar' >>> q.getlist('foo') -['bar'] +[u'bar'] >>> q.urlencode() 'foo=bar&name=john' @@ -196,12 +196,12 @@ True >>> q = QueryDict('foo=bar') >>> q['foo'] -'bar' +u'bar' >>> q['bar'] Traceback (most recent call last): ... -MultiValueDictKeyError: "Key 'bar' not found in <MultiValueDict: {'foo': ['bar']}>" +MultiValueDictKeyError: "Key 'bar' not found in <MultiValueDict: {u'foo': [u'bar']}>" >>> q['something'] = 'bar' Traceback (most recent call last): @@ -209,13 +209,13 @@ Traceback (most recent call last): AttributeError: This QueryDict instance is immutable >>> q.get('foo', 'default') -'bar' +u'bar' >>> q.get('bar', 'default') 'default' >>> q.getlist('foo') -['bar'] +[u'bar'] >>> q.getlist('bar') [] @@ -243,16 +243,16 @@ False False >>> q.items() -[('foo', 'bar')] +[(u'foo', u'bar')] >>> q.lists() -[('foo', ['bar'])] +[(u'foo', [u'bar'])] >>> q.keys() -['foo'] +[u'foo'] >>> q.values() -['bar'] +[u'bar'] >>> len(q) 1 @@ -292,7 +292,7 @@ AttributeError: This QueryDict instance is immutable >>> q = QueryDict('vote=yes&vote=no') >>> q['vote'] -'no' +u'no' >>> q['something'] = 'bar' Traceback (most recent call last): @@ -300,13 +300,13 @@ Traceback (most recent call last): AttributeError: This QueryDict instance is immutable >>> q.get('vote', 'default') -'no' +u'no' >>> q.get('foo', 'default') 'default' >>> q.getlist('vote') -['yes', 'no'] +[u'yes', u'no'] >>> q.getlist('foo') [] @@ -334,16 +334,16 @@ False False >>> q.items() -[('vote', 'no')] +[(u'vote', u'no')] >>> q.lists() -[('vote', ['yes', 'no'])] +[(u'vote', [u'yes', u'no'])] >>> q.keys() -['vote'] +[u'vote'] >>> q.values() -['no'] +[u'no'] >>> len(q) 1 @@ -381,6 +381,16 @@ Traceback (most recent call last): ... AttributeError: This QueryDict instance is immutable +# QueryDicts must be able to handle invalid input encoding (in this case, bad +# UTF-8 encoding). +>>> q = QueryDict('foo=bar&foo=\xff') + +>>> q['foo'] +u'\ufffd' + +>>> q.getlist('foo') +[u'bar', u'\ufffd'] + """ from django.http import QueryDict |
