From: Barry Warsaw Date: Sun, 1 Oct 2000 04:28:43 +0000 (+0000) Subject: Added a zip() test where one of the arguments is an instance whose X-Git-Tag: v2.0c1~181 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=370a29fe42e8581fca51c59de62c11b7d28abaab;p=python Added a zip() test where one of the arguments is an instance whose class has no __getitem__(). This raises an AttributeError. --- diff --git a/Lib/test/test_b2.py b/Lib/test/test_b2.py index e7553ed1f5..8ee4a03d6c 100644 --- a/Lib/test/test_b2.py +++ b/Lib/test/test_b2.py @@ -290,6 +290,18 @@ except: 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