Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0157e7a

Browse files
committed
Added some single tuple/list unpacking for JPython regression testing.
1 parent cb5b5ba commit 0157e7a

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Lib/test/test_unpack.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ def __getitem__(self, i):
4747
if a <> 0 or b <> 1 or c <> 2:
4848
raise TestFailed
4949

50+
# single element unpacking, with extra syntax
51+
if verbose:
52+
print 'unpack single tuple/list'
53+
st = (99,)
54+
sl = [100]
55+
a, = st
56+
if a <> 99:
57+
raise TestFailed
58+
b, = sl
59+
if b <> 100:
60+
raise TestFailed
61+
5062
# now for some failures
5163

5264
# unpacking non-sequence

0 commit comments

Comments
 (0)