mirror of
https://github.com/readthedocs/sphinx-autoapi
synced 2024-11-10 01:10:27 +00:00
Fixed tests on Python <3.8
This commit is contained in:
parent
31d4beb959
commit
7330297a83
@ -1,3 +1,5 @@
|
||||
import sys
|
||||
|
||||
import astroid
|
||||
from autoapi.mappers.python import astroid_utils
|
||||
import pytest
|
||||
@ -104,12 +106,27 @@ class TestAstroidUtils(object):
|
||||
"signature,expected",
|
||||
[
|
||||
("a: bool, b: int = 5", {"a": "bool", "b": "int"}),
|
||||
("a: bool, /, b: int, *, c: str", {"a": "bool", "b": "int", "c": "str"}),
|
||||
(
|
||||
pytest.param(
|
||||
"a: bool, /, b: int, *, c: str",
|
||||
{"a": "bool", "b": "int", "c": "str"},
|
||||
marks=pytest.mark.skipif(
|
||||
sys.version_info[:2] < (3, 8), reason="Uses Python 3.8+ syntax"
|
||||
),
|
||||
),
|
||||
pytest.param(
|
||||
"a: bool, /, b: int, *args, c: str, **kwargs",
|
||||
{"a": "bool", "b": "int", "c": "str"},
|
||||
marks=pytest.mark.skipif(
|
||||
sys.version_info[:2] < (3, 8), reason="Uses Python 3.8+ syntax"
|
||||
),
|
||||
),
|
||||
pytest.param(
|
||||
"a: int, *args, b: str, **kwargs",
|
||||
{"a": "int", "b": "str"},
|
||||
marks=pytest.mark.skipif(
|
||||
sys.version_info[:2] < (3, 8), reason="Uses Python 3.8+ syntax"
|
||||
),
|
||||
),
|
||||
("a: int, *args, b: str, **kwargs", {"a": "int", "b": "str"}),
|
||||
],
|
||||
)
|
||||
def test_parse_annotations(self, signature, expected):
|
||||
@ -129,10 +146,19 @@ class TestAstroidUtils(object):
|
||||
"signature,expected",
|
||||
[
|
||||
("a: bool, b: int = 5, c='hi'", "a: bool, b: int = 5, c='hi'"),
|
||||
("a: bool, /, b: int, *, c: str", "a: bool, /, b: int, *, c: str"),
|
||||
(
|
||||
pytest.param(
|
||||
"a: bool, /, b: int, *, c: str",
|
||||
"a: bool, /, b: int, *, c: str",
|
||||
marks=pytest.mark.skipif(
|
||||
sys.version_info[:2] < (3, 8), reason="Uses Python 3.8+ syntax"
|
||||
),
|
||||
),
|
||||
pytest.param(
|
||||
"a: bool, /, b: int, *args, c: str, **kwargs",
|
||||
"a: bool, /, b: int, *args, c: str, **kwargs",
|
||||
marks=pytest.mark.skipif(
|
||||
sys.version_info[:2] < (3, 8), reason="Uses Python 3.8+ syntax"
|
||||
),
|
||||
),
|
||||
("a: int, *args, b: str, **kwargs", "a: int, *args, b: str, **kwargs"),
|
||||
("a: 'A'", "a: A"),
|
||||
|
Loading…
Reference in New Issue
Block a user