From 0c6614c78904b6ad0a92033a3224b95d182f1b17 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 18 Jan 2001 23:36:14 +0000 Subject: [PATCH] Add test that ensures hash([]) and hash({}) raise TypeError. --- Lib/test/test_b1.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lib/test/test_b1.py b/Lib/test/test_b1.py index 95110790f0a..ea09d0be8ce 100644 --- a/Lib/test/test_b1.py +++ b/Lib/test/test_b1.py @@ -267,6 +267,12 @@ def identity(item): 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)'