summaryrefslogtreecommitdiffstats
path: root/tests/test_pycode
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/test_pycode/__init__.py0
-rw-r--r--tests/test_pycode/test_pycode.py (renamed from tests/test_pycode.py)0
-rw-r--r--tests/test_pycode/test_pycode_ast.py (renamed from tests/test_pycode_ast.py)10
-rw-r--r--tests/test_pycode/test_pycode_parser.py (renamed from tests/test_pycode_parser.py)0
4 files changed, 8 insertions, 2 deletions
diff --git a/tests/test_pycode/__init__.py b/tests/test_pycode/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/test_pycode/__init__.py
diff --git a/tests/test_pycode.py b/tests/test_pycode/test_pycode.py
index 5739787..5739787 100644
--- a/tests/test_pycode.py
+++ b/tests/test_pycode/test_pycode.py
diff --git a/tests/test_pycode_ast.py b/tests/test_pycode/test_pycode_ast.py
index 5efd0cb..1ed43e1 100644
--- a/tests/test_pycode_ast.py
+++ b/tests/test_pycode/test_pycode_ast.py
@@ -18,7 +18,7 @@ from sphinx.pycode.ast import unparse as ast_unparse
("a and b and c", "a and b and c"), # BoolOp
("b'bytes'", "b'bytes'"), # Bytes
("object()", "object()"), # Call
- ("1234", "1234"), # Constant
+ ("1234", "1234"), # Constant, Num
("{'key1': 'value1', 'key2': 'value2'}",
"{'key1': 'value1', 'key2': 'value2'}"), # Dict
("a / b", "a / b"), # Div
@@ -34,7 +34,6 @@ from sphinx.pycode.ast import unparse as ast_unparse
("a % b", "a % b"), # Mod
("a * b", "a * b"), # Mult
("sys", "sys"), # Name, NameConstant
- ("1234", "1234"), # Num
("not a", "not a"), # Not
("a or b", "a or b"), # Or
("a**b", "a**b"), # Pow
@@ -52,6 +51,13 @@ from sphinx.pycode.ast import unparse as ast_unparse
"lambda x=0, /, y=1, *args, z, **kwargs: ..."), # posonlyargs
("0x1234", "0x1234"), # Constant
("1_000_000", "1_000_000"), # Constant
+ ("Tuple[:,:]", "Tuple[:, :]"), # Index, Subscript, 2x Slice
+ ("Tuple[1:2]", "Tuple[1:2]"), # Index, Subscript, Slice(no-step)
+ ("Tuple[1:2:3]", "Tuple[1:2:3]"), # Index, Subscript, Slice
+ ("x[:, np.newaxis, :, :]",
+ "x[:, np.newaxis, :, :]"), # Index, Subscript, numpy extended syntax
+ ("y[:, 1:3][np.array([0, 2, 4]), :]",
+ "y[:, 1:3][np.array([0, 2, 4]), :]"), # Index, 2x Subscript, numpy extended syntax
])
def test_unparse(source, expected):
module = ast.parse(source)
diff --git a/tests/test_pycode_parser.py b/tests/test_pycode/test_pycode_parser.py
index fde648d..fde648d 100644
--- a/tests/test_pycode_parser.py
+++ b/tests/test_pycode/test_pycode_parser.py