Merge pull request #8376 from tk0miya/test_with_py310

Test with py310
This commit is contained in:
Takeshi KOMIYA
2020-11-10 23:20:08 +09:00
committed by GitHub
4 changed files with 18 additions and 4 deletions

View File

@@ -4,11 +4,12 @@ on: [push, pull_request]
jobs:
ubuntu:
runs-on: ubuntu-16.04
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
name: [py35, py36, py37, py38, py39]
os: [ubuntu-16.04]
include:
- name: py35
python: 3.5
@@ -26,6 +27,10 @@ jobs:
python: 3.9
docutils: du16
coverage: "--cov ./ --cov-append --cov-config setup.cfg"
- name: py310-dev
python: 3.10-dev
docutils: du16
os: ubuntu-latest # required
env:
PYTEST_ADDOPTS: ${{ matrix.coverage }}
@@ -33,6 +38,12 @@ jobs:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
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:
python-version: ${{ matrix.python }}
- name: Check Python version

View File

@@ -470,7 +470,7 @@ def signature(subject: Callable, bound_method: bool = False, follow_wrapped: boo
raise
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)
for i, param in enumerate(parameters):
if param.name in annotations:

View File

@@ -258,7 +258,7 @@ def stringify(annotation: Any) -> str:
if isinstance(annotation, str):
if annotation.startswith("'") and annotation.endswith("'"):
# might be a double Forward-ref'ed type. Go unquoting.
return annotation[1:-2]
return annotation[1:-1]
else:
return annotation
elif isinstance(annotation, TypeVar):

View File

@@ -177,7 +177,10 @@ def test_signature_annotations():
# Instance annotations
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
sig = inspect.signature(f12)