Skip to content

Commit bf51e2f

Browse files
committed
tests/basics: Add tests for list and bytearray growing using themselves.
1 parent a5500a8 commit bf51e2f

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

tests/basics/bytearray_slice_assign.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@
5151
b[:-1] = bytearray(500)
5252
print(len(b), b[0], b[-1])
5353

54+
# extension with self on RHS
55+
b = bytearray(x)
56+
b[4:] = b
57+
print(b)
58+
5459
# Assignment of bytes to array slice
5560
b = bytearray(2)
5661
b[1:1] = b"12345"

tests/basics/list_slice_assign_grow.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@
2626
l = list(x)
2727
l[100:100] = [10, 20, 30, 40]
2828
print(l)
29+
30+
# growing by using itself on RHS
31+
l = list(range(10))
32+
l[4:] = l
33+
print(l)

0 commit comments

Comments
 (0)