File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed
Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ def __get_builtin_constructor(name):
8888 except ImportError :
8989 pass # no extension module, this hash is unsupported.
9090
91- raise ValueError ('unsupported hash type %s' % name )
91+ raise ValueError ('unsupported hash type ' + name )
9292
9393
9494def __get_openssl_constructor (name ):
Original file line number Diff line number Diff line change @@ -111,12 +111,8 @@ def test_algorithms_available(self):
111111 issubset (hashlib .algorithms_available ))
112112
113113 def test_unknown_hash (self ):
114- try :
115- hashlib .new ('spam spam spam spam spam' )
116- except ValueError :
117- pass
118- else :
119- self .assertTrue (0 == "hashlib didn't reject bogus hash name" )
114+ self .assertRaises (ValueError , hashlib .new , 'spam spam spam spam spam' )
115+ self .assertRaises (TypeError , hashlib .new , 1 )
120116
121117 def test_get_builtin_constructor (self ):
122118 get_builtin_constructor = hashlib .__dict__ [
@@ -135,6 +131,7 @@ def test_get_builtin_constructor(self):
135131 sys .modules ['_md5' ] = _md5
136132 else :
137133 del sys .modules ['_md5' ]
134+ self .assertRaises (TypeError , get_builtin_constructor , 3 )
138135
139136 def test_hexdigest (self ):
140137 for name in self .supported_hash_names :
You can’t perform that action at this time.
0 commit comments