[Python-checkins] CVS: /python/nondist/src/Compiler/tests test_slice.py,1.1,1.2
Jeremy Hylton
jhylton@cnri.reston.va.us
Tue, 15 Feb 2000 18:43:47 -0500
Update of /projects/cvsroot//python/nondist/src/Compiler/tests
In directory goon.cnri.reston.va.us:/home/jhylton/python/nondist/src/Compiler/tests
Modified Files:
test_slice.py
Log Message:
test sliceobjs
Index: test_slice.py
===================================================================
RCS file: /projects/cvsroot//python/nondist/src/Compiler/tests/test_slice.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** test_slice.py 2000/02/10 00:48:47 1.1
--- test_slice.py 2000/02/15 23:43:44 1.2
***************
*** 1,5 ****
def test():
l = range(1, 10)
! print l[2:3]
print l[-3:-1]
print l[:]
--- 1,17 ----
+ class IGottaTestThis:
+ def __getitem__(self, arg):
+ print arg
+ return len(arg)
+ def __setitem__(self, loc, val):
+ print loc
+ print val
+ raise IndexError, "where exactly is that?"
+
def test():
l = range(1, 10)
! try:
! print l[2:3:2]
! except TypeError:
! print "this is a little odd"
print l[-3:-1]
print l[:]
***************
*** 11,13 ****
--- 23,32 ----
print l
+ obj = IGottaTestThis()
+ print obj[5:10:-5, ..., 1:3:6]
+ try:
+ obj[5:10:-5, ..., 1:3:6] = 4, 5
+ except IndexError:
+ print "didn't think it would work anyway"
+
test()