Skip to content

Commit 83d86a0

Browse files
committed
Rename PaddingError to InvalidInputLengthError
1 parent 43ee889 commit 83d86a0

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

basest/core/decode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
absolute_import, division, print_function, unicode_literals
55
)
66

7-
from ..exceptions import PaddingError
7+
from ..exceptions import InvalidInputLengthError
88
from .encode import encode_raw
99
from .utils import ints_to_symbols, symbols_to_ints, validate_symbol_tables
1010

@@ -20,7 +20,7 @@ def decode_raw(input_base, output_base, input_ratio, output_ratio, input_data):
2020
"""
2121
# raise an exception early if padding was truncated
2222
if len(input_data) % input_ratio != 0:
23-
raise PaddingError(
23+
raise InvalidInputLengthError(
2424
'Decoding requires input length to be an exact multiple of the '
2525
'input ratio, or for padding to be used to ensure this.'
2626
)

basest/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ImproperUsageError(ValueError):
2929
pass
3030

3131

32-
class PaddingError(ValueError):
32+
class InvalidInputLengthError(ValueError):
3333
"""
3434
This exception is raised when an attempt is made to decode data which is
3535
not the correct length (e.g. where the length is not an exact multiple of

tests/core/test_encode_decode_raw.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from ddt import data, ddt, unpack
1010

1111
from basest.core import decode_raw, encode_raw
12-
from basest.exceptions import ImproperUsageError, PaddingError
12+
from basest.exceptions import ImproperUsageError, InvalidInputLengthError
1313

1414

1515
@ddt
@@ -152,9 +152,10 @@ def test_decode_raw_rejects_input_of_incorrect_length(
152152
):
153153
"""
154154
When decode_raw() is called with input data which is not of a length
155-
exactly divisible by the input ratio, PaddingError should be raised.
155+
exactly divisible by the input ratio, InvalidInputLengthError should be
156+
raised.
156157
"""
157-
with self.assertRaises(PaddingError):
158+
with self.assertRaises(InvalidInputLengthError):
158159
decode_raw(
159160
input_base=input_base, output_base=output_base,
160161
input_ratio=input_ratio, output_ratio=output_ratio,

0 commit comments

Comments
 (0)