]> granicus.if.org Git - python/commitdiff
Add test that ensures hash([]) and hash({}) raise TypeError.
authorGuido van Rossum <guido@python.org>
Thu, 18 Jan 2001 23:36:14 +0000 (23:36 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 18 Jan 2001 23:36:14 +0000 (23:36 +0000)
Lib/test/test_b1.py

index 95110790f0a9f3cf84bb9efa2160a5030f239d9c..ea09d0be8ce04c124ab392f418fd1106fae0c84f 100644 (file)
@@ -267,6 +267,12 @@ if not hash(1) == hash(1L) == hash(1.0): raise TestFailed, 'numeric hash()'
 hash('spam')
 hash((0,1,2,3))
 def f(): pass
+try: hash([])
+except TypeError: pass
+else: raise TestFailed, "hash([]) should raise an exception"
+try: hash({})
+except TypeError: pass
+else: raise TestFailed, "hash({}) should raise an exception"
 
 print 'hex'
 if hex(16) != '0x10': raise TestFailed, 'hex(16)'