mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
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:
parent
c86adb4c5c
commit
13b55291ac
5 changed files with 111 additions and 18 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue