chiark / gitweb /
documentation/python: test that fully qualified links get a precedence.
authorVladimír Vondruš <mosra@centrum.cz>
Tue, 10 Sep 2019 17:37:17 +0000 (19:37 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Tue, 10 Sep 2019 20:10:14 +0000 (22:10 +0200)
They don't, unfortunately.

documentation/test_python/inspect_type_links/docs.rst
documentation/test_python/inspect_type_links/inspect_type_links.html [new file with mode: 0644]
documentation/test_python/inspect_type_links/inspect_type_links/__init__.py
documentation/test_python/test_inspect.py

index 90ce02191daea4a2804809ebffa54bb0c5667cd6..4548d45b882d1938ba5554b860308dcf34673d76 100644 (file)
@@ -3,6 +3,10 @@
     :ref:`first.Foo` and :ref:`inspect_type_links.first.Foo` should lead to the
     same class.
 
+    :ref:`open()` should lead to the Python builtin, for the local
+    function we need to say :ref:`inspect_type_links.open()`. If it would be
+    the other way around, there would be no simple way to link to builtins.
+
 .. py:module:: inspect_type_links.first
 
     :ref:`Foo`, :ref:`first.Foo` and :ref:`inspect_type_links.first.Foo` should
diff --git a/documentation/test_python/inspect_type_links/inspect_type_links.html b/documentation/test_python/inspect_type_links/inspect_type_links.html
new file mode 100644 (file)
index 0000000..16df2d1
--- /dev/null
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>inspect_type_links | My Python Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Python Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          inspect_type_links <span class="m-thin">module</span>
+        </h1>
+        <div class="m-block m-default">
+          <h3>Contents</h3>
+          <ul>
+            <li>
+              Reference
+              <ul>
+                <li><a href="#packages">Modules</a></li>
+                <li><a href="#classes">Classes</a></li>
+                <li><a href="#functions">Functions</a></li>
+              </ul>
+            </li>
+          </ul>
+        </div>
+<p><a class="m-doc" href="inspect_type_links.first.Foo.html">first.Foo</a> and <a class="m-doc" href="inspect_type_links.first.Foo.html">inspect_type_links.first.Foo</a> should lead to the
+same class.</p>
+<p><a class="m-doc-external" href="https://docs.python.org/3/library/functions.html#open">open()</a> should lead to the Python builtin, for the local
+function we need to say <a class="m-doc" href="inspect_type_links.html#open">inspect_type_links.open()</a>. If it would be
+the other way around, there would be no simple way to link to builtins.</p>
+        <section id="namespaces">
+          <h2><a href="#namespaces">Modules</a></h2>
+          <dl class="m-doc">
+            <dt>module <a href="inspect_type_links.first.html" class="m-doc">first</a></dt>
+            <dd>First module</dd>
+            <dt>module <a href="inspect_type_links.second.html" class="m-doc">second</a></dt>
+            <dd>Second module</dd>
+          </dl>
+        </section>
+        <section id="classes">
+          <h2><a href="#classes">Classes</a></h2>
+          <dl class="m-doc">
+            <dt>class <a href="inspect_type_links.Bar.html" class="m-doc">Bar</a></dt>
+            <dd>Another class in the root module</dd>
+            <dt>class <a href="inspect_type_links.Foo.html" class="m-doc">Foo</a></dt>
+            <dd>A class in the root module</dd>
+          </dl>
+        </section>
+        <section id="functions">
+          <h2><a href="#functions">Functions</a></h2>
+          <dl class="m-doc">
+            <dt id="open">
+              <span class="m-doc-wrap-bumper">def <a href="#open" class="m-doc-self">open</a>(</span><span class="m-doc-wrap">)</span>
+            </dt>
+            <dd>A function that opens cans.</dd>
+          </dl>
+        </section>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index 09fe0bc317f05c3222c55f47a5227eac059bb039..b248126e22d75b181650bb28b384b689e46ba1a7 100644 (file)
@@ -5,3 +5,6 @@ class Foo:
 
 class Bar:
     """Another class in the root module"""
+
+def open():
+    """A function that opens cans."""
index 27ff89ea97095c2be44580209182b989e2cc1b7e..4ba365f99ad1a6f848ae5f4ed7c9986f69ebd087 100644 (file)
@@ -174,6 +174,7 @@ class TypeLinks(BaseInspectTestCase):
 
         self.assertEqual(*self.actual_expected_contents('index.html'))
 
+        self.assertEqual(*self.actual_expected_contents('inspect_type_links.html'))
         self.assertEqual(*self.actual_expected_contents('inspect_type_links.first.html'))
         self.assertEqual(*self.actual_expected_contents('inspect_type_links.first.Foo.html'))
         self.assertEqual(*self.actual_expected_contents('inspect_type_links.first.Foo.Foo.html'))