mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
13
.github/workflows/main.yml
vendored
13
.github/workflows/main.yml
vendored
@@ -4,11 +4,12 @@ on: [push, pull_request]
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ubuntu:
|
ubuntu:
|
||||||
runs-on: ubuntu-16.04
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
name: [py35, py36, py37, py38, py39]
|
name: [py35, py36, py37, py38, py39]
|
||||||
|
os: [ubuntu-16.04]
|
||||||
include:
|
include:
|
||||||
- name: py35
|
- name: py35
|
||||||
python: 3.5
|
python: 3.5
|
||||||
@@ -26,6 +27,10 @@ jobs:
|
|||||||
python: 3.9
|
python: 3.9
|
||||||
docutils: du16
|
docutils: du16
|
||||||
coverage: "--cov ./ --cov-append --cov-config setup.cfg"
|
coverage: "--cov ./ --cov-append --cov-config setup.cfg"
|
||||||
|
- name: py310-dev
|
||||||
|
python: 3.10-dev
|
||||||
|
docutils: du16
|
||||||
|
os: ubuntu-latest # required
|
||||||
env:
|
env:
|
||||||
PYTEST_ADDOPTS: ${{ matrix.coverage }}
|
PYTEST_ADDOPTS: ${{ matrix.coverage }}
|
||||||
|
|
||||||
@@ -33,6 +38,12 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up Python ${{ matrix.python }}
|
- name: Set up Python ${{ matrix.python }}
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
|
if: "!endsWith(matrix.python, '-dev')"
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python }}
|
||||||
|
- name: Set up Python ${{ matrix.python }} (deadsnakes)
|
||||||
|
uses: deadsnakes/action@v1.0.0
|
||||||
|
if: endsWith(matrix.python, '-dev')
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python }}
|
python-version: ${{ matrix.python }}
|
||||||
- name: Check Python version
|
- name: Check Python version
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ def signature(subject: Callable, bound_method: bool = False, follow_wrapped: boo
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Resolve forwared reference annotations using ``get_type_hints()`` and type_aliases.
|
# Resolve annotations using ``get_type_hints()`` and type_aliases.
|
||||||
annotations = typing.get_type_hints(subject, None, type_aliases)
|
annotations = typing.get_type_hints(subject, None, type_aliases)
|
||||||
for i, param in enumerate(parameters):
|
for i, param in enumerate(parameters):
|
||||||
if param.name in annotations:
|
if param.name in annotations:
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ def stringify(annotation: Any) -> str:
|
|||||||
if isinstance(annotation, str):
|
if isinstance(annotation, str):
|
||||||
if annotation.startswith("'") and annotation.endswith("'"):
|
if annotation.startswith("'") and annotation.endswith("'"):
|
||||||
# might be a double Forward-ref'ed type. Go unquoting.
|
# might be a double Forward-ref'ed type. Go unquoting.
|
||||||
return annotation[1:-2]
|
return annotation[1:-1]
|
||||||
else:
|
else:
|
||||||
return annotation
|
return annotation
|
||||||
elif isinstance(annotation, TypeVar):
|
elif isinstance(annotation, TypeVar):
|
||||||
|
|||||||
@@ -177,7 +177,10 @@ def test_signature_annotations():
|
|||||||
|
|
||||||
# Instance annotations
|
# Instance annotations
|
||||||
sig = inspect.signature(f11)
|
sig = inspect.signature(f11)
|
||||||
assert stringify_signature(sig) == '(x: CustomAnnotation, y: 123) -> None'
|
if sys.version_info < (3, 10):
|
||||||
|
assert stringify_signature(sig) == '(x: CustomAnnotation, y: 123) -> None'
|
||||||
|
else:
|
||||||
|
assert stringify_signature(sig) == '(x: CustomAnnotation(), y: 123) -> None'
|
||||||
|
|
||||||
# tuple with more than two items
|
# tuple with more than two items
|
||||||
sig = inspect.signature(f12)
|
sig = inspect.signature(f12)
|
||||||
|
|||||||
Reference in New Issue
Block a user