summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_hashlib.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
index ad2ed69..76754b6 100644
--- a/Lib/test/test_hashlib.py
+++ b/Lib/test/test_hashlib.py
@@ -909,7 +909,11 @@ class HashLibTestCase(unittest.TestCase):
continue
# all other types have DISALLOW_INSTANTIATION
for constructor in constructors:
- h = constructor()
+ # In FIPS mode some algorithms are not available raising ValueError
+ try:
+ h = constructor()
+ except ValueError:
+ continue
with self.subTest(constructor=constructor):
hash_type = type(h)
self.assertRaises(TypeError, hash_type)
@@ -930,7 +934,11 @@ class HashLibTestCase(unittest.TestCase):
for algorithm, constructors in self.constructors_to_test.items():
# all other types have DISALLOW_INSTANTIATION
for constructor in constructors:
- hash_type = type(constructor())
+ # In FIPS mode some algorithms are not available raising ValueError
+ try:
+ hash_type = type(constructor())
+ except ValueError:
+ continue
with self.subTest(hash_type=hash_type):
with self.assertRaisesRegex(TypeError, "immutable type"):
hash_type.value = False