diff options
author | Samuele Pedroni <pedronis@openend.se> | 2004-02-21 21:03:30 (GMT) |
---|---|---|
committer | Samuele Pedroni <pedronis@openend.se> | 2004-02-21 21:03:30 (GMT) |
commit | 8036c836305f9770d6b242ccd504b543476058ff (patch) | |
tree | cba12b7d3c8dae6bc31d85d21d62388815bae22e /Lib/test/test_extcall.py | |
parent | 0bc9c919e80f0a1b2815ca98d273251fb344067a (diff) | |
download | cpython-8036c836305f9770d6b242ccd504b543476058ff.zip cpython-8036c836305f9770d6b242ccd504b543476058ff.tar.gz cpython-8036c836305f9770d6b242ccd504b543476058ff.tar.bz2 |
adding passing test. testing for g(*Nothing()) where Nothing is a user-defined iterator.
Diffstat (limited to 'Lib/test/test_extcall.py')
-rw-r--r-- | Lib/test/test_extcall.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py index f85baf8..284dbb2 100644 --- a/Lib/test/test_extcall.py +++ b/Lib/test/test_extcall.py @@ -86,6 +86,31 @@ class Nothing: raise IndexError, i 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} d2 = d.copy() |