diff --git a/kenjutsu/format.py b/kenjutsu/format.py index 431b637..7a8b4af 100644 --- a/kenjutsu/format.py +++ b/kenjutsu/format.py @@ -75,7 +75,7 @@ def reformat_slice(a_slice, a_length=None): new_slice = index_to_slice(a_slice) elif isinstance(a_slice, collections.Sequence): if not all(map(lambda i: isinstance(i, numbers.Integral), a_slice)): - raise ValueError( + raise TypeError( "Arbitrary sequences not permitted." " All elements must be of integral type." ) @@ -86,7 +86,7 @@ def reformat_slice(a_slice, a_length=None): new_slice.append(reformat_slice(i, a_length)) return new_slice elif not isinstance(a_slice, slice): - raise ValueError( + raise TypeError( "Expected a `slice` type. Instead got `%s`." % str(a_slice) ) diff --git a/tests/test_format.py b/tests/test_format.py index ca53aee..60d144a 100644 --- a/tests/test_format.py +++ b/tests/test_format.py @@ -109,7 +109,7 @@ def test_index_to_slice(self): def test_reformat_slice(self): - with self.assertRaises(ValueError) as e: + with self.assertRaises(TypeError) as e: format.reformat_slice(None) self.assertEqual( @@ -125,7 +125,7 @@ def test_reformat_slice(self): "Slice cannot have a step size of `0`." ) - with self.assertRaises(ValueError) as e: + with self.assertRaises(TypeError) as e: format.reformat_slice([None]) self.assertEqual( diff --git a/tests/test_kenjutsu.py b/tests/test_kenjutsu.py index cda11f1..5ccb57c 100644 --- a/tests/test_kenjutsu.py +++ b/tests/test_kenjutsu.py @@ -35,7 +35,7 @@ def setUp(self): def test_reformat_slice(self): - with self.assertRaises(ValueError) as e: + with self.assertRaises(TypeError) as e: kenjutsu.reformat_slice(None) self.assertEqual( @@ -51,7 +51,7 @@ def test_reformat_slice(self): "Slice cannot have a step size of `0`." ) - with self.assertRaises(ValueError) as e: + with self.assertRaises(TypeError) as e: kenjutsu.reformat_slice([None]) self.assertEqual(