Skip to content

Commit d1771bb

Browse files
committed
tests/unicode_subscr.py: Detailed test for subscripting unicode strings.
1 parent ed1c194 commit d1771bb

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/unicode/unicode_subscr.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
a = '¢пр'
2+
3+
print(a[0], a[0:1])
4+
print(a[1], a[1:2])
5+
print(a[2], a[2:3])
6+
try:
7+
print(a[3])
8+
except IndexError:
9+
print("IndexError")
10+
print(a[3:4])
11+
12+
print(a[-1])
13+
print(a[-2], a[-2:-1])
14+
print(a[-3], a[-3:-2])
15+
try:
16+
print(a[-4])
17+
except IndexError:
18+
print("IndexError")
19+
print(a[-4:-3])
20+
21+
print(a[0:2])
22+
print(a[1:3])
23+
print(a[2:4])

0 commit comments

Comments
 (0)