diff options
Diffstat (limited to 'Lib/test/test_docxmlrpc.py')
-rw-r--r-- | Lib/test/test_docxmlrpc.py | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/Lib/test/test_docxmlrpc.py b/Lib/test/test_docxmlrpc.py index 2c13cec..da22f61 100644 --- a/Lib/test/test_docxmlrpc.py +++ b/Lib/test/test_docxmlrpc.py @@ -19,8 +19,8 @@ def server(evt, numrequests): serv.set_server_title("DocXMLRPCServer Test Documentation") serv.set_server_name("DocXMLRPCServer Test Docs") serv.set_server_documentation( -"""This is an XML-RPC server's documentation, but the server can be used by -POSTing to /RPC2. Try self.add, too.""") + "This is an XML-RPC server's documentation, but the server " + "can be used by POSTing to /RPC2. Try self.add, too.") # Create and register classes and functions class TestClass(object): @@ -107,9 +107,9 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase): self.client.request("GET", "/") response = self.client.getresponse() - self.assertTrue( -"""<dl><dt><a name="-<lambda>"><strong><lambda></strong></a>(x, y)</dt></dl>""" - in response.read()) + self.assertIn('<dl><dt><a name="-<lambda>"><strong>' + '<lambda></strong></a>(x, y)</dt></dl>', + response.read()) def test_autolinking(self): """Test that the server correctly automatically wraps references to PEPS @@ -121,9 +121,17 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase): self.client.request("GET", "/") response = self.client.getresponse() - self.assertTrue( # This is ugly ... how can it be made better? -"""<dl><dt><a name="-add"><strong>add</strong></a>(x, y)</dt><dd><tt>Add two instances together. This follows <a href="http://www.python.org/dev/peps/pep-0008/">PEP008</a>, but has nothing<br>\nto do with <a href="http://www.rfc-editor.org/rfc/rfc1952.txt">RFC1952</a>. Case should matter: pEp008 and rFC1952. Things<br>\nthat start with http and ftp should be auto-linked, too:<br>\n<a href="http://google.com">http://google.com</a>.</tt></dd></dl>""" - in response.read()) + self.assertIn( + ('<dl><dt><a name="-add"><strong>add</strong></a>(x, y)</dt><dd>' + '<tt>Add two instances together. This ' + 'follows <a href="http://www.python.org/dev/peps/pep-0008/">' + 'PEP008</a>, but has nothing<br>\nto do ' + 'with <a href="http://www.rfc-editor.org/rfc/rfc1952.txt">' + 'RFC1952</a>. Case should matter: pEp008 ' + 'and rFC1952. Things<br>\nthat start ' + 'with http and ftp should be ' + 'auto-linked, too:<br>\n<a href="http://google.com">' + 'http://google.com</a>.</tt></dd></dl>'), response.read()) def test_system_methods(self): """Test the precense of three consecutive system.* methods. @@ -134,9 +142,29 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase): self.client.request("GET", "/") response = self.client.getresponse() - self.assertTrue( -"""<dl><dt><a name="-system.listMethods"><strong>system.listMethods</strong></a>()</dt><dd><tt><a href="#-system.listMethods">system.listMethods</a>() => [\'add\', \'subtract\', \'multiple\']<br>\n <br>\nReturns a list of the methods supported by the server.</tt></dd></dl>\n <dl><dt><a name="-system.methodHelp"><strong>system.methodHelp</strong></a>(method_name)</dt><dd><tt><a href="#-system.methodHelp">system.methodHelp</a>(\'add\') => "Adds two integers together"<br>\n <br>\nReturns a string containing documentation for the specified method.</tt></dd></dl>\n <dl><dt><a name="-system.methodSignature"><strong>system.methodSignature</strong></a>(method_name)</dt><dd><tt><a href="#-system.methodSignature">system.methodSignature</a>(\'add\') => [double, int, int]<br>\n <br>\nReturns a list describing the signature of the method. In the<br>\nabove example, the add method takes two integers as arguments<br>\nand returns a double result.<br>\n <br>\nThis server does NOT support system.methodSignature.</tt></dd></dl>""" - in response.read()) + self.assertIn( + ('<dl><dt><a name="-system.listMethods"><strong>system.listMethods' + '</strong></a>()</dt><dd><tt><a href="#-system.listMethods">system' + '.listMethods</a>() => [\'add\', \'subtract\',' + ' \'multiple\']<br>\n <br>\nReturns a list' + ' of the methods supported by the' + ' server.</tt></dd></dl>\n <dl><dt><a name="-system.methodHelp">' + '<strong>system.methodHelp</strong></a>(method_name)</dt><dd><tt>' + '<a href="#-system.methodHelp">system.methodHelp</a>(\'add\') ' + '=> "Adds two integers together"<br>\n ' + '<br>\nReturns a string containing documentation' + ' for the specified method.</tt></dd></dl>\n ' + '<dl><dt><a name="-system.methodSignature"><strong>system.' + 'methodSignature</strong></a>(method_name)</dt><dd><tt><a href="#-' + 'system.methodSignature">system.methodSignature</a>(\'add\') ' + '=> [double, int, int]<br>\n <br>\nReturns' + ' a list describing the signature of' + ' the method. In the<br>\nabove example,' + ' the add method takes two integers' + ' as arguments<br>\nand returns a double' + ' result.<br>\n <br>\nThis server does ' + 'NOT support system.methodSignature.</tt></dd></dl>'), + response.read()) def test_autolink_dotted_methods(self): """Test that selfdot values are made strong automatically in the @@ -144,8 +172,8 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase): self.client.request("GET", "/") response = self.client.getresponse() - self.assertTrue("""Try self.<strong>add</strong>, too.""" in - response.read()) + self.assertIn("""Try self.<strong>add</strong>, too.""", + response.read()) def test_main(): test_support.run_unittest(DocXMLRPCHTTPGETServer) |