Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10692 Modified Files: test_extcall.py Log Message: adding passing test. testing for g(*Nothing()) where Nothing is a user-defined iterator. Index: test_extcall.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_extcall.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** test_extcall.py 31 May 2003 07:04:16 -0000 1.20 --- test_extcall.py 21 Feb 2004 21:03:30 -0000 1.21 *************** *** 87,90 **** --- 87,115 ---- g(*Nothing()) + class Nothing: + def __init__(self): + self.c = 0 + def __iter__(self): + return self + try: + g(*Nothing()) + except TypeError, attr: + pass + else: + print "should raise TypeError" + + class Nothing: + def __init__(self): + self.c = 0 + def __iter__(self): + return self + def next(self): + if self.c == 4: + raise StopIteration + c = self.c + self.c += 1 + return c + g(*Nothing()) + # make sure the function call doesn't stomp on the dictionary? d = {'a': 1, 'b': 2, 'c': 3}
participants (1)
-
pedronisï¼ users.sourceforge.net