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

class has no __getitem__().  This raises an AttributeError.
This commit is contained in:
Barry Warsaw 2000-10-01 04:28:43 +00:00
parent cc4adf27f4
commit 370a29fe42
1 changed files with 12 additions and 0 deletions

View File

@ -290,6 +290,18 @@ def __getitem__(self, i):
raise TestFailed, 'zip(None) - expected TypeError, got %s' % e
if not exc:
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