MCPcopy Index your code
hub / github.com/python/cpython / test_autolinking

Method test_autolinking

Lib/test/test_docxmlrpc.py:136–156  ·  view source on GitHub ↗

Test that the server correctly automatically wraps references to PEPS and RFCs with links, and that it linkifies text starting with http or ftp protocol prefixes. The documentation for the "add" method contains the test material.

(self)

Source from the content-addressed store, hash-verified

134 @make_request_and_skipIf(sys.flags.optimize >= 2,
135 "Docstrings are omitted with -O2 and above")
136 def test_autolinking(self):
137 """Test that the server correctly automatically wraps references to
138 PEPS and RFCs with links, and that it linkifies text starting with
139 http or ftp protocol prefixes.
140
141 The documentation for the "add" method contains the test material.
142 """
143 self.client.request("GET", "/")
144 response = self.client.getresponse().read()
145
146 self.assertIn(
147 (b'<dl><dt><a name="-add"><strong>add</strong></a>(x, y)</dt><dd>'
148 b'<tt>Add&nbsp;two&nbsp;instances&nbsp;together.&nbsp;This&nbsp;'
149 b'follows&nbsp;<a href="https://peps.python.org/pep-0008/">'
150 b'PEP008</a>,&nbsp;but&nbsp;has&nbsp;nothing<br>\nto&nbsp;do&nbsp;'
151 b'with&nbsp;<a href="https://www.rfc-editor.org/rfc/rfc1952.txt">'
152 b'RFC1952</a>.&nbsp;Case&nbsp;should&nbsp;matter:&nbsp;pEp008&nbsp;'
153 b'and&nbsp;rFC1952.&nbsp;&nbsp;Things<br>\nthat&nbsp;start&nbsp;'
154 b'with&nbsp;http&nbsp;and&nbsp;ftp&nbsp;should&nbsp;be&nbsp;'
155 b'auto-linked,&nbsp;too:<br>\n<a href="http://google.com">'
156 b'http://google.com</a>.</tt></dd></dl>'), response)
157
158 @make_request_and_skipIf(sys.flags.optimize >= 2,
159 "Docstrings are omitted with -O2 and above")

Callers

nothing calls this directly

Calls 4

assertInMethod · 0.80
requestMethod · 0.45
readMethod · 0.45
getresponseMethod · 0.45

Tested by

no test coverage detected