[Checkins] SVN: bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/ Updated to work with latest manuel and other dependencies.
Jim Fulton
jim at zope.com
Mon Jan 18 13:01:42 EST 2010
Log message for revision 108212:
Updated to work with latest manuel and other dependencies.
Changed:
U bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/decorator.test
U bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/index.txt
U bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/main.test
U bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/more.txt
-=-
Modified: bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/decorator.test
===================================================================
--- bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/decorator.test 2010-01-18 17:28:53 UTC (rev 108211)
+++ bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/decorator.test 2010-01-18 18:01:42 UTC (rev 108212)
@@ -173,7 +173,7 @@
... @bobo.resource('/:name', content_type='text/plain; charset=Latin-1')
... def hi(request, name=None):
... print 'request:'
- ... print str(request).replace('\r', '')
+ ... print str(request).replace('\r', '').rstrip()
... print '-----'
... return 'Hi %s.' % name
@@ -208,10 +208,8 @@
>>> call_resource(hi, '/foo')
request:
- GET /foo
+ GET /foo HTTP/1.0
Host: localhost:80
- <BLANKLINE>
- <BLANKLINE>
-----
BoboException:
{'body': 'Hi None.',
@@ -228,10 +226,8 @@
>>> call_resource(hi, '/bar')
request:
- GET /bar
+ GET /bar HTTP/1.0
Host: localhost:80
- <BLANKLINE>
- <BLANKLINE>
-----
BoboException:
{'body': 'Hi bar.',
@@ -321,10 +317,8 @@
>>> call_resource(hi, '/bar')
request:
- GET /bar
+ GET /bar HTTP/1.0
Host: localhost:80
- <BLANKLINE>
- <BLANKLINE>
-----
200 OK
Content-Length: 7
@@ -493,10 +487,8 @@
>>> call_resource(sub1, '/x/foo')
sub1 x
request:
- GET /x/foo
+ GET /x/foo HTTP/1.0
Host: localhost:80
- <BLANKLINE>
- <BLANKLINE>
-----
BoboException:
{'body': 'Hi None.',
Modified: bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/index.txt
===================================================================
--- bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/index.txt 2010-01-18 17:28:53 UTC (rev 108211)
+++ bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/index.txt 2010-01-18 18:01:42 UTC (rev 108212)
@@ -87,13 +87,15 @@
http://localhost:8080/hello.html
-.. -> url strip
+.. -> url
+ >>> url = url.strip()
you'll get the greeting::
Hello world!
-.. -> expected_body strip
+.. -> expected_body
+ >>> expected_body = expected_body.strip()
>>> app.get(url, status=200).body == expected_body
True
@@ -105,7 +107,8 @@
http://localhost:8080/
-.. -> url strip
+.. -> url
+ >>> url = url.strip()
We'll do this by providing a URL path::
@@ -148,13 +151,15 @@
http://localhost:8080/?name=Sally
-.. -> url strip
+.. -> url
+ >>> url = url.strip()
We'll get the output::
Hello Sally!
-.. -> expected_body strip
+.. -> expected_body
+ >>> expected_body = expected_body.strip()
>>> app.get(url, status=200).body == expected_body
True
@@ -290,13 +295,15 @@
http://localhost:8080/greeters/myapp?name=Sally
-.. -> url strip
+.. -> url
+ >>> url = url.strip()
for which we get the output::
Hello Sally! My name is myapp.
-.. -> expected_body strip
+.. -> expected_body
+ >>> expected_body = expected_body.strip()
>>> app.get(url).body == expected_body
True
@@ -326,13 +333,15 @@
http://localhost:8080/greeters?name=Sally
-.. -> url strip
+.. -> url
+ >>> url = url.strip()
for which we get the output::
Hello Sally! My name is Bobo.
-.. -> expected_body strip
+.. -> expected_body
+ >>> expected_body = expected_body.strip()
>>> app.get(url).body == expected_body
True
@@ -341,13 +350,15 @@
http://localhost:8080/greeters/?name=Sally
-.. -> url strip
+.. -> url
+ >>> url = url.strip()
we get the output::
Hello Sally! My name is .
-.. -> expected_body strip
+.. -> expected_body
+ >>> expected_body = expected_body.strip()
>>> app.get(url).body == expected_body
True
@@ -369,13 +380,15 @@
http://localhost:8080/greeters/myapp.html?name=Sally
-.. -> url strip
+.. -> url
+ >>> url = url.strip()
And get::
Hello Sally! My name is myapp.
-.. -> expected_body strip
+.. -> expected_body
+ >>> expected_body = expected_body.strip()
>>> app.get(url).body == expected_body
True
@@ -395,7 +408,8 @@
http://localhost:8080/greeters?name=Sally
-.. -> url strip
+.. -> url
+ >>> url = url.strip()
>>> app.get(url, status=200).body
'Hello Sally! My name is Bobo.'
@@ -404,7 +418,8 @@
http://localhost:8080/greeters/jim.html?name=Sally
-.. -> url strip
+.. -> url
+ >>> url = url.strip()
>>> app.get(url, status=200).body
'Hello Sally! My name is jim.'
@@ -486,7 +501,8 @@
http://localhost:8080/employees/1/summary.html
-.. -> url strip
+.. -> url
+ >>> url = url.strip()
>>> print app.get(url).body
<BLANKLINE>
@@ -510,13 +526,15 @@
http://localhost:8080/employees/1
-.. -> url strip
+.. -> url
+ >>> url = url.strip()
which would redirect to::
http://localhost:8080/employees/1/
-.. -> expected_location strip
+.. -> expected_location
+ >>> expected_location = expected_location.strip()
>>> response = app.get(url, status=302)
>>> response.headers['location'] == expected_location
@@ -590,13 +608,15 @@
http://localhost:8080/employees/1/documents/hobbies/sports.html
-.. -> url strip
+.. -> url
+ >>> url = url.strip()
which outputs::
I like to ski.
-.. -> expected_body strip
+.. -> expected_body
+ >>> expected_body = expected_body.strip()
>>> app.get(url).body == expected_body
True
Modified: bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/main.test
===================================================================
--- bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/main.test 2010-01-18 17:28:53 UTC (rev 108211)
+++ bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/main.test 2010-01-18 18:01:42 UTC (rev 108212)
@@ -288,13 +288,13 @@
>>> response # doctest: +ELLIPSIS
<Response at ... 302 Found>
- >>> print response
- 302 Found
- Location: http://www.python.org/
- content-type: text/html; charset=UTF-8
- Content-Length: 26
+ >>> print str(response).lower()
+ 302 found
+ location: http://www.python.org/
+ content-type: text/html; charset=utf-8
+ content-length: 26
<BLANKLINE>
- See http://www.python.org/
+ see http://www.python.org/
>>> response = bobo.redirect('http://www.python.org/', 301)
>>> response # doctest: +ELLIPSIS
Modified: bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/more.txt
===================================================================
--- bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/more.txt 2010-01-18 17:28:53 UTC (rev 108211)
+++ bobo/branches/new-manuel/bobodoctestumentation/src/bobodoctestumentation/more.txt 2010-01-18 18:01:42 UTC (rev 108212)
@@ -280,7 +280,8 @@
Hi, I'm employee 1
- .. -> expected1 strip
+ .. -> expected1
+ >>> expected1 = expected1.strip()
>>> app.get(url1, status=200).body == expected1
True
@@ -291,13 +292,15 @@
http://localhost:8080/docs/bobs/hi.html
- .. -> url2 strip
+ .. -> url2
+ >>> url2 = url2.strip()
We'll get output::
Hi. I'm Bob.
- .. -> expected2 strip
+ .. -> expected2
+ >>> expected2 = expected2.strip()
>>> app.get(url2, status=200).body == expected2
True
@@ -309,13 +312,15 @@
http://localhost:8080/long/winded/path/bobo/lets/get/on/with/it
- .. -> url3 strip
+ .. -> url3
+ >>> url3 = url3.strip()
We'll get output::
Hi, I'm bobo
- .. -> expected3 strip
+ .. -> expected3
+ >>> expected3 = expected3.strip()
>>> app.get(url3, status=200).body == expected3
True
@@ -326,13 +331,15 @@
http://localhost:8080/us/1/
- .. -> url4 strip
+ .. -> url4
+ >>> url4 = url4.strip()
We'll get output::
Hi, I'm employee 1
- .. -> expected4 strip
+ .. -> expected4
+ >>> expected4 = expected4.strip()
>>> app.get(url4, status=200).body == expected4
True
@@ -343,13 +350,15 @@
http://localhost:8080/folks/employee/1/
- .. -> url5 strip
+ .. -> url5
+ >>> url5 = url5.strip()
We'll get output::
Hi, I'm employee 1
- .. -> expected5 strip
+ .. -> expected5
+ >>> expected5 = expected5.strip()
>>> app.get(url5, status=200).body == expected5
True
@@ -360,13 +369,15 @@
http://localhost:8080/ho/silly
- .. -> url6 strip
+ .. -> url6
+ >>> url6 = url6.strip()
We'll get output::
Hi, I'm silly
- .. -> expected6 strip
+ .. -> expected6
+ >>> expected6 = expected6.strip()
>> app.get(url6, status=200).body == expected6
True
@@ -611,7 +622,8 @@
http://localhost:8080/hi.html?who=you
-.. -> url1 strip
+.. -> url1
+ >>> url1 = url1.strip()
We'll get the response::
@@ -619,7 +631,8 @@
Content-Type: text/html; charset=UTF-8
Hi you
-.. -> expected1 strip
+.. -> expected1
+ >>> expected1 = expected1.strip()
>>> str(app.get(url1)).strip() == expected1
True
@@ -628,7 +641,8 @@
http://localhost:8080/ho
-.. -> url2 strip
+.. -> url2
+ >>> url2 = url2.strip()
We'll get::
@@ -636,7 +650,8 @@
Content-Type: text/html; charset=UTF-8
not found
-.. -> expected2 strip
+.. -> expected2
+ >>> expected2 = expected2.strip()
>>> str(app.get(url2, status=404)).strip() == expected2
True
@@ -645,7 +660,8 @@
http://localhost:8080/hi.html
-.. -> url3 strip
+.. -> url3
+ >>> url3 = url3.strip()
We'll get::
@@ -653,7 +669,8 @@
Content-Type: text/html; charset=UTF-8
Missing who
-.. -> expected3 strip
+.. -> expected3
+ >>> expected3 = expected3.strip()
>>> str(app.get(url3)).strip() == expected3
True
@@ -665,7 +682,8 @@
Content-Type: text/plain
bad method POST
-.. -> expected4 strip
+.. -> expected4
+ >>> expected4 = expected4.strip()
>>> str(app.post(url3, 'who=me', status=405)).strip() == expected4
True
More information about the checkins
mailing list