This commit was manufactured by cvs2svn to create tag 'r211c1'.
[python/dscho.git] / Lib / test / test_operations.py
blob4c76a8fa51a6c1f82ddec1372e95f9ce34e2da35
1 # Python test set -- part 3, built-in operations.
4 print '3. Operations'
5 print 'XXX Mostly not yet implemented'
8 print '3.1 Dictionary lookups succeed even if __cmp__() raises an exception'
10 # SourceForge bug #112558:
11 # http://sourceforge.net/bugs/?func=detailbug&bug_id=112558&group_id=5470
13 class BadDictKey:
14 def __hash__(self):
15 return hash(self.__class__)
17 def __cmp__(self, other):
18 if isinstance(other, self.__class__):
19 print "raising error"
20 raise RuntimeError, "gotcha"
21 return other
23 d = {}
24 x1 = BadDictKey()
25 x2 = BadDictKey()
26 d[x1] = 1
27 d[x2] = 2
28 print "No exception passed through."