From a5535f2b36fb718661ef87d7ce8549548cb9e1af Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Mon, 10 Dec 2007 20:18:07 +0000 Subject: Fixed doc xml rpc tests and server --- Lib/DocXMLRPCServer.py | 6 +++--- Lib/test/test_docxmlrpc.py | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Lib/DocXMLRPCServer.py b/Lib/DocXMLRPCServer.py index c95210a..86c7bfb 100644 --- a/Lib/DocXMLRPCServer.py +++ b/Lib/DocXMLRPCServer.py @@ -123,12 +123,12 @@ class ServerHTMLDoc(pydoc.HTMLDoc): result = result + '

%s

\n' % doc contents = [] - method_items = methods.items() + method_items = list(methods.items()) method_items.sort() for key, value in method_items: contents.append(self.docroutine(value, key, funcs=fdict)) result = result + self.bigsection( - 'Methods', '#ffffff', '#eeaa77', pydoc.join(contents)) + 'Methods', '#ffffff', '#eeaa77', ''.join(contents)) return result @@ -239,7 +239,7 @@ class DocXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): self.send_header("Content-type", "text/html") self.send_header("Content-length", str(len(response))) self.end_headers() - self.wfile.write(response) + self.wfile.write(response.encode()) # shut down the connection self.wfile.flush() diff --git a/Lib/test/test_docxmlrpc.py b/Lib/test/test_docxmlrpc.py index 55c2143..1a056f8 100644 --- a/Lib/test/test_docxmlrpc.py +++ b/Lib/test/test_docxmlrpc.py @@ -106,7 +106,7 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase): response = self.client.getresponse() self.assert_( -"""
<lambda>(x, y)
""" +b"""
<lambda>(x, y)
""" in response.read()) def test_autolinking(self): @@ -120,7 +120,7 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase): response = self.client.getresponse() self.assert_( # This is ugly ... how can it be made better? -"""
add(x, y)
Add two instances together. This follows PEP008, but has nothing
\nto do with RFC1952. Case should matter: pEp008 and rFC1952.  Things
\nthat start with http and ftp should be auto-linked, too:
\nhttp://google.com.
""" +b"""
add(x, y)
Add two instances together. This follows PEP008, but has nothing
\nto do with RFC1952. Case should matter: pEp008 and rFC1952.  Things
\nthat start with http and ftp should be auto-linked, too:
\nhttp://google.com.
""" in response.read()) def test_system_methods(self): @@ -130,11 +130,10 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase): related to that process. """ self.client.request("GET", "/") - response = self.client.getresponse() + response = self.client.getresponse().read() self.assert_( -"""
system.listMethods()
system.listMethods() => [\'add\', \'subtract\', \'multiple\']
\n 
\nReturns a list of the methods supported by the server.
\n
system.methodHelp(method_name)
system.methodHelp(\'add\') => "Adds two integers together"
\n 
\nReturns a string containing documentation for the specified method.
\n
system.methodSignature(method_name)
system.methodSignature(\'add\') => [double, int, int]
\n 
\nReturns a list describing the signature of the method. In the
\nabove example, the add method takes two integers as arguments
\nand returns a double result.
\n 
\nThis server does NOT support system.methodSignature.
""" - in response.read()) +b"""
system.methodHelp(method_name)
system.methodHelp(\'add\') => "Adds two integers together"
\n 
\nReturns a string containing documentation for the specified method.
\n
system.methodSignature(method_name)
system.methodSignature(\'add\') => [double, int, int]
\n 
\nReturns a list describing the signature of the method. In the
\nabove example, the add method takes two integers as arguments
\nand returns a double result.
\n 
\nThis server does NOT support system.methodSignature.
\n
test_method(arg)
Test method\'s docs. This method truly does very little.
""" in response) def test_autolink_dotted_methods(self): """Test that selfdot values are made strong automatically in the @@ -142,7 +141,7 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase): self.client.request("GET", "/") response = self.client.getresponse() - self.assert_("""Try self.add, too.""" in + self.assert_(b"""Try self.add, too.""" in response.read()) def test_main(): -- cgit v0.12