summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2000-10-01 04:28:43 (GMT)
committerBarry Warsaw <barry@python.org>2000-10-01 04:28:43 (GMT)
commit370a29fe42e8581fca51c59de62c11b7d28abaab (patch)
treed7c002521d5dc2a78f670bc05bf58cad08910e90 /Lib
parentcc4adf27f4d45592751dc3bcfd0caae667d482fb (diff)
downloadcpython-370a29fe42e8581fca51c59de62c11b7d28abaab.zip
cpython-370a29fe42e8581fca51c59de62c11b7d28abaab.tar.gz
cpython-370a29fe42e8581fca51c59de62c11b7d28abaab.tar.bz2
Added a zip() test where one of the arguments is an instance whose
class has no __getitem__(). This raises an AttributeError.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_b2.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_b2.py b/Lib/test/test_b2.py
index e7553ed..8ee4a03 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