(self)
| 1167 | |
| 1168 | @support.cpython_only |
| 1169 | def test_disallow_instantiation(self): |
| 1170 | for algorithm, constructors in self.constructors_to_test.items(): |
| 1171 | if algorithm.startswith(("sha3_", "shake", "blake")): |
| 1172 | # _sha3 and _blake types can be instantiated |
| 1173 | continue |
| 1174 | # all other types have DISALLOW_INSTANTIATION |
| 1175 | for constructor in constructors: |
| 1176 | # In FIPS mode some algorithms are not available raising ValueError |
| 1177 | try: |
| 1178 | h = constructor() |
| 1179 | except ValueError: |
| 1180 | continue |
| 1181 | with self.subTest(constructor=constructor): |
| 1182 | support.check_disallow_instantiation(self, type(h)) |
| 1183 | |
| 1184 | @unittest.skipUnless(HASH is not None, 'need _hashlib') |
| 1185 | def test_hash_disallow_instantiation(self): |
nothing calls this directly
no test coverage detected