hashlib has two new constant attributes: algorithms_guaranteed and

algorithms_avaiable that respectively list the names of hash algorithms
guaranteed to exist in all Python implementations and the names of hash
algorithms available in the current process.

Renames the attribute new in 3.2a0 'algorithms' to 'algorithms_guaranteed'.
This commit is contained in:
Gregory P. Smith 2010-09-06 08:30:23 +00:00
parent c86adb4c5c
commit 13b55291ac
5 changed files with 111 additions and 18 deletions

View file

@ -101,11 +101,15 @@ class HashLibTestCase(unittest.TestCase):
c = cons(a)
c.hexdigest()
def test_algorithms_attribute(self):
self.assertEqual(hashlib.algorithms,
def test_algorithms_guaranteed(self):
self.assertEqual(hashlib.algorithms_guaranteed,
tuple(_algo for _algo in self.supported_hash_names
if _algo.islower()))
def test_algorithms_available(self):
self.assertTrue(set(hashlib.algorithms_guaranteed).
issubset(hashlib.algorithms_available))
def test_unknown_hash(self):
try:
hashlib.new('spam spam spam spam spam')