Fix #7964: autodoc: Tuple in default value is wrongly rendered

This implements tuple literal support to sphinx.pycode.ast.unparse().
This commit is contained in:
Takeshi KOMIYA
2020-10-03 12:00:33 +09:00
parent 1ff1f3cf5b
commit 785f4d695c
3 changed files with 18 additions and 3 deletions

View File

@@ -53,7 +53,7 @@ from sphinx.pycode import ast
("+ a", "+ a"), # UAdd
("- 1", "- 1"), # UnaryOp
("- a", "- a"), # USub
("(1, 2, 3)", "1, 2, 3"), # Tuple
("(1, 2, 3)", "(1, 2, 3)"), # Tuple
("()", "()"), # Tuple (empty)
])
def test_unparse(source, expected):