]> granicus.if.org Git - python/commitdiff
Added a zip() test where one of the arguments is an instance whose
authorBarry Warsaw <barry@python.org>
Sun, 1 Oct 2000 04:28:43 +0000 (04:28 +0000)
committerBarry Warsaw <barry@python.org>
Sun, 1 Oct 2000 04:28:43 +0000 (04:28 +0000)
class has no __getitem__().  This raises an AttributeError.

Lib/test/test_b2.py

index e7553ed1f5d06f80f7ad0040d79e0897d4de3dab..8ee4a03d6c9d6488cc006dcdda06711aad8162be 100644 (file)
@@ -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