Commits

Anonymous committed 221c4a5

jython compat for doctests: don't assume cStringIO.StringIO __str__ matches
CPython's nor CPython dict ordering

Comments (0)

Files changed (2)

tests/test_request.txt

 fresh environment dictionary with all the basic keys such a dictionary
 should have.
 
+    >>> from cStringIO import InputType
     >>> from dtopt import ELLIPSIS
     >>> from webob import Request, UTC
     >>> req = Request.blank('/')
     'GET /\r\nHost: localhost:80\r\n\r\n'
     >>> req.environ # doctest: +ELLIPSIS
     {...}
-    >>> req.body_file # doctest: +ELLIPSIS
-    <cStringIO.StringI object at ...>
+    >>> isinstance(req.body_file, InputType)
+    True
     >>> req.scheme
     'http'
     >>> req.method
     ['e', 'f']
     >>> req.method = 'POST'
     >>> req.body = 'x=y&d=g'
-    >>> req.body_file # doctest: +ELLIPSIS
-    <cStringIO.StringI object at ...>
+    >>> isinstance(req.body_file, InputType)
+    True
     >>> req.environ['CONTENT_LENGTH']
     '7'
     >>> req.params
 Sometimes conditional headers are problematic.  You can remove them:
 
     >>> from datetime import datetime
+    >>> from webob.compat import sorted
     >>> req = Request.blank('/')
     >>> req.if_none_match = 'some-etag'
     >>> req.if_modified_since = datetime(2005, 1, 1, 12, 0)
     >>> req.environ['HTTP_ACCEPT_ENCODING'] = 'gzip'
-    >>> print req.headers
-    {'If-None-Match': 'some-etag', 'Host': 'localhost:80', 'Accept-Encoding': 'gzip', 'If-Modified-Since': 'Sat, 01 Jan 2005 12:00:00 GMT'}
+    >>> print sorted(req.headers.items())
+    [('Accept-Encoding', 'gzip'), ('Host', 'localhost:80'), ('If-Modified-Since', 'Sat, 01 Jan 2005 12:00:00 GMT'), ('If-None-Match', 'some-etag')]
     >>> req.remove_conditional_headers()
     >>> print req.headers
     {'Host': 'localhost:80'}
     >>> req = Request.blank('/')
     >>> req.content_length = length
     >>> req.body_file = data
-    >>> req.body_file
-    <cStringIO.StringI object at ...>
+    >>> isinstance(req.body_file, InputType)
+    True
     >>> len(req.body)
     10250
     >>> req.body_file

webob/multidict.py

     ['a', 'a', 'b']
     >>> d.items()
     [('a', 1), ('a', 2), ('b', 4)]
-    >>> d.mixed()
-    {'a': [1, 2], 'b': 4}
+    >>> d.mixed() == {'a': [1, 2], 'b': 4}
+    True
     >>> MultiDict([('a', 'b')], c=2)
     MultiDict([('a', 'b'), ('c', 2)])
     """}