summaryrefslogtreecommitdiffstats
path: root/tests/roots/test-ext-autodoc/target/overload.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:25:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:25:40 +0000
commitcf7da1843c45a4c2df7a749f7886a2d2ba0ee92a (patch)
tree18dcde1a8d1f5570a77cd0c361de3b490d02c789 /tests/roots/test-ext-autodoc/target/overload.py
parentInitial commit. (diff)
downloadsphinx-cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a.tar.xz
sphinx-cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a.zip
Adding upstream version 7.2.6.upstream/7.2.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/roots/test-ext-autodoc/target/overload.py')
-rw-r--r--tests/roots/test-ext-autodoc/target/overload.py90
1 files changed, 90 insertions, 0 deletions
diff --git a/tests/roots/test-ext-autodoc/target/overload.py b/tests/roots/test-ext-autodoc/target/overload.py
new file mode 100644
index 0000000..4bcb6ea
--- /dev/null
+++ b/tests/roots/test-ext-autodoc/target/overload.py
@@ -0,0 +1,90 @@
+from __future__ import annotations
+
+from typing import Any, overload
+
+
+@overload
+def sum(x: int, y: int = 0) -> int:
+ ...
+
+
+@overload
+def sum(x: float, y: float = 0.0) -> float:
+ ...
+
+
+@overload
+def sum(x: str, y: str = ...) -> str:
+ ...
+
+
+def sum(x, y=None):
+ """docstring"""
+ return x + y
+
+
+class Math:
+ """docstring"""
+
+ @overload
+ def sum(self, x: int, y: int = 0) -> int:
+ ...
+
+ @overload
+ def sum(self, x: float, y: float = 0.0) -> float:
+ ...
+
+ @overload
+ def sum(self, x: str, y: str = ...) -> str:
+ ...
+
+ def sum(self, x, y=None):
+ """docstring"""
+ return x + y
+
+
+class Foo:
+ """docstring"""
+
+ @overload
+ def __new__(cls, x: int, y: int) -> Foo:
+ ...
+
+ @overload
+ def __new__(cls, x: str, y: str) -> Foo:
+ ...
+
+ def __new__(cls, x, y):
+ pass
+
+
+class Bar:
+ """docstring"""
+
+ @overload
+ def __init__(cls, x: int, y: int) -> None:
+ ...
+
+ @overload
+ def __init__(cls, x: str, y: str) -> None:
+ ...
+
+ def __init__(cls, x, y):
+ pass
+
+
+class Meta(type):
+ @overload
+ def __call__(cls, x: int, y: int) -> Any:
+ ...
+
+ @overload
+ def __call__(cls, x: str, y: str) -> Any:
+ ...
+
+ def __call__(cls, x, y):
+ pass
+
+
+class Baz(metaclass=Meta):
+ """docstring"""