summaryrefslogtreecommitdiff
path: root/Lib/test/test_unparse.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_unparse.py')
-rw-r--r--Lib/test/test_unparse.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py
index 1393bcce74..410df7dbb7 100644
--- a/Lib/test/test_unparse.py
+++ b/Lib/test/test_unparse.py
@@ -110,7 +110,7 @@ with f() as x, g() as y:
docstring_prefixes = [
"",
- "class foo():\n ",
+ "class foo:\n ",
"def foo():\n ",
"async def foo():\n ",
]
@@ -367,6 +367,19 @@ class CosmeticTestCase(ASTTestCase):
self.check_src_roundtrip("call((yield x))")
self.check_src_roundtrip("return x + (yield x)")
+
+ def test_class_bases_and_keywords(self):
+ self.check_src_roundtrip("class X:\n pass")
+ self.check_src_roundtrip("class X(A):\n pass")
+ self.check_src_roundtrip("class X(A, B, C, D):\n pass")
+ self.check_src_roundtrip("class X(x=y):\n pass")
+ self.check_src_roundtrip("class X(metaclass=z):\n pass")
+ self.check_src_roundtrip("class X(x=y, z=d):\n pass")
+ self.check_src_roundtrip("class X(A, x=y):\n pass")
+ self.check_src_roundtrip("class X(A, **kw):\n pass")
+ self.check_src_roundtrip("class X(*args):\n pass")
+ self.check_src_roundtrip("class X(*args, **kwargs):\n pass")
+
def test_docstrings(self):
docstrings = (
'"""simple doc string"""',