diff --git a/src/tests/test_shamira.py b/src/tests/test_shamira.py --- a/src/tests/test_shamira.py +++ b/src/tests/test_shamira.py @@ -20,9 +20,9 @@ class TestShamira(TestCase): os.urandom=cls._urandom def test_shareByte(self): - with self.assertRaises(ValueError): # too few shares + with self.assertRaises(InvalidParams): # too few shares _shareByte(b"a",5,4) - with self.assertRaises(ValueError): # too many shares + with self.assertRaises(InvalidParams): # too many shares _shareByte(b"a",5,255) with self.assertRaises(ValueError): # not castable to int _shareByte("x",2,3) @@ -53,7 +53,7 @@ class TestShamira(TestCase): s=secret if raw else secret.encode("utf-8") self.assertNotEqual(reconstruct(*shares[:k-1],encoding=encoding,raw=True), s) shares=generate(b"\xfeaa",2,3) - with self.assertRaises(UnicodeDecodeError): + with self.assertRaises(DecodingException): reconstruct(*shares) def testEncode(self): @@ -63,7 +63,7 @@ class TestShamira(TestCase): self.assertEqual(encode(share,encoding), "2."+encodedStr) def testDecode(self): - with self.assertRaises(ValueError): + with self.assertRaises(MalformedShare): decode("AAA") decode("1.") decode(".AAA") @@ -95,7 +95,7 @@ class TestShamira(TestCase): ["00010203"] # no index ]: with self.subTest(shares=shares): - with self.assertRaises(ValueError): + with self.assertRaises(DetectionException): detectEncoding(shares) self.assertEqual(detectEncoding(["10.00010203"]), "hex") self.assertEqual(detectEncoding(["2.AAAQEAY="]), "b32")