Anonymous avatar Anonymous committed 25831a5

o include docs/ in nose's doctest run, minus jsonrpc-example, as it requires a
package not on pypi
o bring docs/ up to date, include missing test-file.txt, don't assume dict
ordering

Comments (0)

Files changed (5)

docs/file-example.txt

    >>> req = Request.blank('/')
    >>> print req.get_response(app)
    200 OK
-   content-type: text/plain
+   content-type: text/plain; charset=UTF-8
    Content-Length: 36
    <BLANKLINE>
    This is a test.  Hello test people!
    >>> req = Request.blank('/')
    >>> print req.get_response(app)
    200 OK
-   content-type: text/plain
+   content-type: text/plain; charset=UTF-8
    Content-Length: 36
    <BLANKLINE>
    This is a test.  Hello test people!
    >>> res = req.get_response(app)
    >>> print res
    200 OK
-   content-type: text/plain
+   content-type: text/plain; charset=UTF-8
    Content-Length: 36
    Last-Modified: ... GMT
    ETag: ...-...

docs/reference.txt

 
 .. code-block:: python
 
+    >>> from webob.compat import sorted
     >>> req.headers['content-type'] = 'application/x-www-urlencoded'
-    >>> req.headers
-    {'Content-Length': '4', 'Content-Type': 'application/x-www-urlencoded', 'Host': 'localhost:80'}
+    >>> sorted(req.headers.items())
+    [('Content-Length', '4'), ('Content-Type', 'application/x-www-urlencoded'), ('Host', 'localhost:80')]
     >>> req.environ['CONTENT_TYPE']
     'application/x-www-urlencoded'
 
 .. code-block:: python
 
     >>> req.POST
-    <NoVars: Not a POST request>
+    <NoVars: Not a POST or form request>
     >>> req.POST.items()  # NoVars can be read like a dict, but not written
     []
     >>> req.method = 'POST'
 
     >>> req.charset = 'utf8'
     >>> req.GET
-    UnicodeMultiDict([(u'check', u'a'), (u'check', u'b'), (u'name', u'Bob')])
+    UnicodeMultiDict([('check', u'a'), ('check', u'b'), ('name', u'Bob')])
 
 If you always want ``str`` values, you can use ``req.str_GET``
 and ``str_POST``.
 
     >>> req.headers['Cookie'] = 'test=value'
     >>> req.cookies
-    UnicodeMultiDict([(u'test', u'value')])
+    UnicodeMultiDict([('test', u'value')])
     >>> req.charset = None
     >>> req.cookies
     {'test': 'value'}
     >>> res.status
     '200 OK'
     >>> res.headerlist
-    [('Content-Length', '0')]
+    [('content-type', 'text/html; charset=UTF-8'), ('Content-Length', '0')]
     >>> res.body
     ''
 
 
 .. code-block:: python
 
-    >>> res = Response(content_type='text/plain')
+    >>> res = Response(content_type='text/plain', charset=None)
     >>> f = res.body_file
     >>> f.write('hey')
     >>> f.write(u'test')
     >>> res.set_cookie('key', 'value', max_age=360, path='/',
     ...                domain='example.org', secure=True)
     >>> res.headers['Set-Cookie']
-    'key=value; Domain=example.org; Max-Age=360; Path=/; secure;'
+    'key=value; Domain=example.org; expires="... GMT"; Max-Age=360; Path=/; secure'
     >>> # To delete a cookie previously set in the client:
     >>> res.delete_cookie('bad_cookie')
     >>> res.headers['Set-Cookie']
-    'bad_cookie=; Max-Age=0; Path=/;'
+    'bad_cookie=; expires="... GMT"; Max-Age=0; Path=/'
 
 The only other real method of note (note that this does *not* delete
 the cookie from clients, only from the response object):
     >>> res = req.get_response(my_app)
     >>> print res
     200 OK
-    content-type: text/plain
-    Content-Length: 394
+    content-type: text/plain; charset=UTF-8
+    Content-Length: ...
     <BLANKLINE>
     HTTP_HOST: 'localhost:80'
     PATH_INFO: '/'
     >>> req = Request.blank('/path/to/something')
     >>> print str(req.get_response(exc)).strip()
     307 Temporary Redirect
-    content-type: text/html
+    content-type: text/html; charset=UTF-8
     location: http://localhost/path/to/foo
     Content-Length: 126
     <BLANKLINE>
     >>> req.accept += 'text/html'
     >>> print str(req.get_response(exc)).strip()
     307 Temporary Redirect
-    content-type: text/html
+    content-type: text/html; charset=UTF-8
     location: http://localhost/path/to/foo
     Content-Length: 270
     <BLANKLINE>

docs/test-file.txt

+This is a test.  Hello test people!
 detailed-errors = True
 with-doctest = True
 doctest-extension = txt
+include = docs
+exclude = jsonrpc-example.txt
       include_package_data=True,
       zip_safe=True,
       test_suite='nose.collector',
-      tests_require=['dtopt', 'nose', 'webtest']
+      tests_require=['dtopt', 'nose', 'tempita', 'webtest', 'wsgiproxy']
       )
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.