| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -88,7 +88,7 @@ def __get_builtin_constructor(name): | |||
| 88 | 88 | except ImportError: | |
| 89 | 89 | pass # no extension module, this hash is unsupported. | |
| 90 | 90 | ||
| 91 | - raise ValueError('unsupported hash type %s' % name) | ||
| 91 | + raise ValueError('unsupported hash type ' + name) | ||
| 92 | 92 | ||
| 93 | 93 | ||
| 94 | 94 | def __get_openssl_constructor(name): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -111,12 +111,8 @@ def test_algorithms_available(self): | |||
| 111 | 111 | issubset(hashlib.algorithms_available)) | |
| 112 | 112 | ||
| 113 | 113 | 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) | ||
| 120 | 116 | ||
| 121 | 117 | def test_get_builtin_constructor(self): | |
| 122 | 118 | get_builtin_constructor = hashlib.__dict__[ | |
@@ -135,6 +131,7 @@ def test_get_builtin_constructor(self): | |||
| 135 | 131 | sys.modules['_md5'] = _md5 | |
| 136 | 132 | else: | |
| 137 | 133 | del sys.modules['_md5'] | |
| 134 | + self.assertRaises(TypeError, get_builtin_constructor, 3) | ||
| 138 | 135 | ||
| 139 | 136 | def test_hexdigest(self): | |
| 140 | 137 | for name in self.supported_hash_names: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments