mirror of
https://github.com/python/cpython.git
synced 2025-10-07 07:31:46 +00:00
bpo-39889: Fix ast.unparse() for subscript. (GH-18824)
This commit is contained in:
parent
31350f9af0
commit
c4928fc1a8
3 changed files with 34 additions and 2 deletions
|
@ -344,6 +344,20 @@ class CosmeticTestCase(ASTTestCase):
|
|||
self.check_src_roundtrip("call((yield x))")
|
||||
self.check_src_roundtrip("return x + (yield x)")
|
||||
|
||||
def test_subscript(self):
|
||||
self.check_src_roundtrip("a[i]")
|
||||
self.check_src_roundtrip("a[i,]")
|
||||
self.check_src_roundtrip("a[i, j]")
|
||||
self.check_src_roundtrip("a[()]")
|
||||
self.check_src_roundtrip("a[i:j]")
|
||||
self.check_src_roundtrip("a[:j]")
|
||||
self.check_src_roundtrip("a[i:]")
|
||||
self.check_src_roundtrip("a[i:j:k]")
|
||||
self.check_src_roundtrip("a[:j:k]")
|
||||
self.check_src_roundtrip("a[i::k]")
|
||||
self.check_src_roundtrip("a[i:j,]")
|
||||
self.check_src_roundtrip("a[i:j, k]")
|
||||
|
||||
def test_docstrings(self):
|
||||
docstrings = (
|
||||
'"""simple doc string"""',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue