diff options
author | Adam Turner <9087854+AA-Turner@users.noreply.github.com> | 2022-04-18 17:33:56 +0100 |
---|---|---|
committer | Adam Turner <9087854+AA-Turner@users.noreply.github.com> | 2022-09-27 18:31:47 +0100 |
commit | 4660b62de0e83f42b6e2ede7a1a19e861e4d34e4 (patch) | |
tree | 9d20745efef0eefb29b923ccd4d2b3d48c2d9254 /tests/test_pycode_ast.py | |
parent | 7649eb1505dada483af9897459f699a2a106bed4 (diff) | |
download | sphinx-git-4660b62de0e83f42b6e2ede7a1a19e861e4d34e4.tar.gz |
Drop Python 3.7
Diffstat (limited to 'tests/test_pycode_ast.py')
-rw-r--r-- | tests/test_pycode_ast.py | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/tests/test_pycode_ast.py b/tests/test_pycode_ast.py index e79e9d99b..85d37f184 100644 --- a/tests/test_pycode_ast.py +++ b/tests/test_pycode_ast.py @@ -1,10 +1,10 @@ """Test pycode.ast""" -import sys +import ast import pytest -from sphinx.pycode import ast +from sphinx.pycode.ast import unparse as ast_unparse @pytest.mark.parametrize('source,expected', [ @@ -48,23 +48,15 @@ from sphinx.pycode import ast ("(1, 2, 3)", "(1, 2, 3)"), # Tuple ("()", "()"), # Tuple (empty) ("(1,)", "(1,)"), # Tuple (single item) + ("lambda x=0, /, y=1, *args, z, **kwargs: x + y + z", + "lambda x=0, /, y=1, *args, z, **kwargs: ..."), # posonlyargs + ("0x1234", "0x1234"), # Constant + ("1_000_000", "1_000_000"), # Constant ]) def test_unparse(source, expected): module = ast.parse(source) - assert ast.unparse(module.body[0].value, source) == expected + assert ast_unparse(module.body[0].value, source) == expected def test_unparse_None(): - assert ast.unparse(None) is None - - -@pytest.mark.skipif(sys.version_info[:2] <= (3, 7), reason='python 3.8+ is required.') -@pytest.mark.parametrize('source,expected', [ - ("lambda x=0, /, y=1, *args, z, **kwargs: x + y + z", - "lambda x=0, /, y=1, *args, z, **kwargs: ..."), # posonlyargs - ("0x1234", "0x1234"), # Constant - ("1_000_000", "1_000_000"), # Constant -]) -def test_unparse_py38(source, expected): - module = ast.parse(source) - assert ast.unparse(module.body[0].value, source) == expected + assert ast_unparse(None) is None |