I was hit by this today.

in test_hashlib.py there is this:



def test_unknown_hash(self):

    self.assertRaises(ValueError, hashlib.new, 'spam spam spam spam spam')

    self.assertRaises(TypeError, hashlib.new, 1)



but in hashlib.py, there is this code:



except ImportError:

    pass # no extension module, this hash is unsupported.

raise ValueError('unsupported hash type %s' % name)





The code will raise ValueError when int(1) is passed in, but the unittests 
expect a TypeError.

So, which is correct?



K
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to