Commit 370a29fe authored by Barry Warsaw's avatar Barry Warsaw

Added a zip() test where one of the arguments is an instance whose

class has no __getitem__().  This raises an AttributeError.
parent cc4adf27
...@@ -290,6 +290,18 @@ except: ...@@ -290,6 +290,18 @@ except:
raise TestFailed, 'zip(None) - expected TypeError, got %s' % e raise TestFailed, 'zip(None) - expected TypeError, got %s' % e
if not exc: if not exc:
raise TestFailed, 'zip(None) - missing expected TypeError' raise TestFailed, 'zip(None) - missing expected TypeError'
class G:
pass
exc = 0
try:
zip(a, G())
except AttributeError:
exc = 1
except:
e = sys.exc_info()[0]
raise TestFailed, 'zip(a, b) - b instance w/o __getitem__'
if not exc:
raise TestFailed, 'zip(a, b) - missing expected AttributeError'
# Epilogue -- unlink the temp file # Epilogue -- unlink the temp file
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment