mirror of https://github.com/python/cpython.git
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:
parent
cc4adf27f4
commit
370a29fe42
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue