summaryrefslogtreecommitdiff
path: root/tests/test_hash.py
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-10-24 23:53:18 +0200
committerMichał Górny <mgorny@gentoo.org>2017-10-25 00:00:20 +0200
commit20197868e5ad9adf6260b86881eb6e35a38d58e8 (patch)
tree916994e34b45f187ac93b9a38b841fb16fff6c30 /tests/test_hash.py
parent25cb3dacc7c414b2540767acef7e2cc06c0375e1 (diff)
downloadgemato-20197868e5ad9adf6260b86881eb6e35a38d58e8.tar.gz
Move exceptions to a separate module
Diffstat (limited to 'tests/test_hash.py')
-rw-r--r--tests/test_hash.py43
1 files changed, 22 insertions, 21 deletions
diff --git a/tests/test_hash.py b/tests/test_hash.py
index d4dc3c1..900ccd7 100644
--- a/tests/test_hash.py
+++ b/tests/test_hash.py
@@ -7,6 +7,7 @@ import io
import tempfile
import unittest
+import gemato.exceptions
import gemato.hash
@@ -23,15 +24,15 @@ class HashAPITest(unittest.TestCase):
gemato.hash.get_hash_by_name('sha1')
def test_get_invalid(self):
- self.assertRaises(gemato.hash.UnsupportedHash,
+ self.assertRaises(gemato.exceptions.UnsupportedHash,
gemato.hash.get_hash_by_name, '_invalid_name_')
def test_get_invalid_pyblake2(self):
- self.assertRaises(gemato.hash.UnsupportedHash,
+ self.assertRaises(gemato.exceptions.UnsupportedHash,
gemato.hash.get_hash_by_name, 'blake2zzz')
def test_get_invalid_pysha3(self):
- self.assertRaises(gemato.hash.UnsupportedHash,
+ self.assertRaises(gemato.exceptions.UnsupportedHash,
gemato.hash.get_hash_by_name, 'sha3_987')
def test_hash_file(self):
@@ -142,126 +143,126 @@ class OptionalHashTest(unittest.TestCase):
try:
self.assertEqual(gemato.hash.hash_bytes(TEST_STRING, 'md4'),
'1bee69a46ba811185c194762abaeae90')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_md4_empty(self):
try:
self.assertEqual(gemato.hash.hash_bytes(b'', 'md4'),
'31d6cfe0d16ae931b73c59d7e0c089c0')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_ripemd160(self):
try:
self.assertEqual(gemato.hash.hash_bytes(TEST_STRING, 'ripemd160'),
'37f332f68db77bd9d7edd4969571ad671cf9dd3b')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_ripemd160_empty(self):
try:
self.assertEqual(gemato.hash.hash_bytes(b'', 'ripemd160'),
'9c1185a5c5e9fc54612808977ee8f548b2258d31')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_blake2b(self):
try:
self.assertEqual(gemato.hash.hash_bytes(TEST_STRING, 'blake2b'),
'a8add4bdddfd93e4877d2746e62817b116364a1fa7bc148d95090bc7333b3673f82401cf7aa2e4cb1ecd90296e3f14cb5413f8ed77be73045b13914cdcd6a918')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_blake2b_empty(self):
try:
self.assertEqual(gemato.hash.hash_bytes(b'', 'blake2b'),
'786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_blake2s(self):
try:
self.assertEqual(gemato.hash.hash_bytes(TEST_STRING, 'blake2s'),
'606beeec743ccbeff6cbcdf5d5302aa855c256c29b88c8ed331ea1a6bf3c8812')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_blake2s_empty(self):
try:
self.assertEqual(gemato.hash.hash_bytes(b'', 'blake2s'),
'69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_sha3_224(self):
try:
self.assertEqual(gemato.hash.hash_bytes(TEST_STRING, 'sha3_224'),
'd15dadceaa4d5d7bb3b48f446421d542e08ad8887305e28d58335795')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_sha3_224_empty(self):
try:
self.assertEqual(gemato.hash.hash_bytes(b'', 'sha3_224'),
'6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_sha3_256(self):
try:
self.assertEqual(gemato.hash.hash_bytes(TEST_STRING, 'sha3_256'),
'69070dda01975c8c120c3aada1b282394e7f032fa9cf32f4cb2259a0897dfc04')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_sha3_256_empty(self):
try:
self.assertEqual(gemato.hash.hash_bytes(b'', 'sha3_256'),
'a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_sha3_384(self):
try:
self.assertEqual(gemato.hash.hash_bytes(TEST_STRING, 'sha3_384'),
'7063465e08a93bce31cd89d2e3ca8f602498696e253592ed26f07bf7e703cf328581e1471a7ba7ab119b1a9ebdf8be41')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_sha3_384_empty(self):
try:
self.assertEqual(gemato.hash.hash_bytes(b'', 'sha3_384'),
'0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_sha3_512(self):
try:
self.assertEqual(gemato.hash.hash_bytes(TEST_STRING, 'sha3_512'),
'01dedd5de4ef14642445ba5f5b97c15e47b9ad931326e4b0727cd94cefc44fff23f07bf543139939b49128caf436dc1bdee54fcb24023a08d9403f9b4bf0d450')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_sha3_512_empty(self):
try:
self.assertEqual(gemato.hash.hash_bytes(b'', 'sha3_512'),
'a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_whirlpool(self):
try:
self.assertEqual(gemato.hash.hash_bytes(TEST_STRING, 'whirlpool'),
'b97de512e91e3828b40d2b0fdce9ceb3c4a71f9bea8d88e75c4fa854df36725fd2b52eb6544edcacd6f8beddfea403cb55ae31f03ad62a5ef54e42ee82c3fb35')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')
def test_whirlpool_empty(self):
try:
self.assertEqual(gemato.hash.hash_bytes(b'', 'whirlpool'),
'19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3')
- except gemato.hash.UnsupportedHash:
+ except gemato.exceptions.UnsupportedHash:
raise unittest.SkipTest('hash not supported')