summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/tests/slice-bstr1.py
blob: 74dbc20617b9f8c8cbcb2eb69faa847d63ccae1e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
print(b"123"[0:1])

print(b"123"[0:2])

print(b"123"[:1])

print(b"123"[1:])

# Idiom for copying sequence
print(b"123"[:])

print(b"123"[:-1])

# Weird cases
print(b"123"[0:0])
print(b"123"[1:0])
print(b"123"[1:1])
print(b"123"[-1:-1])
print(b"123"[-3:])
print(b"123"[-3:3])
print(b"123"[0:])
print(b"123"[:0])
print(b"123"[:-3])
print(b"123"[:-4])
# Range check testing, don't segfault, please ;-)
print(b"123"[:1000000])
print(b"123"[1000000:])
print(b"123"[:-1000000])
print(b"123"[-1000000:])
# No IndexError!
print(b""[1:1])
print(b""[-1:-1])