python/dist/src/Lib/test test_extcall.py, 1.17, 1.17.14.1
Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9516 Modified Files: Tag: release22-maint 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.17 retrieving revision 1.17.14.1 diff -C2 -d -r1.17 -r1.17.14.1 *** test_extcall.py 24 Aug 2001 19:11:57 -0000 1.17 --- test_extcall.py 21 Feb 2004 20:58:03 -0000 1.17.14.1 *************** *** 76,79 **** --- 76,104 ---- 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