blob: e85ead4ba965b6c75046ac22d0453cb4e33b64b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# test builtin slice attributes access
# print slice attributes
class A:
def __getitem__(self, idx):
print(idx.start, idx.stop, idx.step)
try:
t = A()[1:2]
except:
print("SKIP")
raise SystemExit
A()[1:2:3]
# test storing to attr (shouldn't be allowed)
class B:
def __getitem__(self, idx):
try:
idx.start = 0
except AttributeError:
print('AttributeError')
B()[:]
|