From cd494b46e2d663deb796981826b749749d11893d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 10 Sep 2019 19:37:17 +0200 Subject: [PATCH] documentation/python: test that fully qualified links get a precedence. They don't, unfortunately. --- .../test_python/inspect_type_links/docs.rst | 4 + .../inspect_type_links.html | 75 +++++++++++++++++++ .../inspect_type_links/__init__.py | 3 + documentation/test_python/test_inspect.py | 1 + 4 files changed, 83 insertions(+) create mode 100644 documentation/test_python/inspect_type_links/inspect_type_links.html diff --git a/documentation/test_python/inspect_type_links/docs.rst b/documentation/test_python/inspect_type_links/docs.rst index 90ce0219..4548d45b 100644 --- a/documentation/test_python/inspect_type_links/docs.rst +++ b/documentation/test_python/inspect_type_links/docs.rst @@ -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 index 00000000..16df2d11 --- /dev/null +++ b/documentation/test_python/inspect_type_links/inspect_type_links.html @@ -0,0 +1,75 @@ + + + + + inspect_type_links | My Python Project + + + + + +
+
+
+
+
+

+ inspect_type_links module +

+
+

Contents

+ +
+

first.Foo and inspect_type_links.first.Foo should lead to the +same class.

+

open() should lead to the Python builtin, for the local +function we need to say inspect_type_links.open(). If it would be +the other way around, there would be no simple way to link to builtins.

+
+

Modules

+
+
module first
+
First module
+
module second
+
Second module
+
+
+
+

Classes

+
+
class Bar
+
Another class in the root module
+
class Foo
+
A class in the root module
+
+
+
+

Functions

+
+
+ def open() +
+
A function that opens cans.
+
+
+
+
+
+
+ + diff --git a/documentation/test_python/inspect_type_links/inspect_type_links/__init__.py b/documentation/test_python/inspect_type_links/inspect_type_links/__init__.py index 09fe0bc3..b248126e 100644 --- a/documentation/test_python/inspect_type_links/inspect_type_links/__init__.py +++ b/documentation/test_python/inspect_type_links/inspect_type_links/__init__.py @@ -5,3 +5,6 @@ class Foo: class Bar: """Another class in the root module""" + +def open(): + """A function that opens cans.""" diff --git a/documentation/test_python/test_inspect.py b/documentation/test_python/test_inspect.py index 27ff89ea..4ba365f9 100644 --- a/documentation/test_python/test_inspect.py +++ b/documentation/test_python/test_inspect.py @@ -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')) -- 2.30.2