Skip to content

Commit e899d76

Browse files
committed
Rename expected error in tests for another specific error case
1 parent 969ce46 commit e899d76

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

basest/exceptions.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,20 @@
22
# -*- coding: utf-8 -*-
33

44

5+
class ImproperUsageError(ValueError):
6+
"""
7+
This exception is raised when an attempt is made to encode data using a
8+
larger output base than the input base AND when the length of the input
9+
data is not exactly divisible by the input ratio.
10+
11+
This cannot be allowed because such options would cause data corruption.
12+
"""
13+
pass
14+
15+
516
class InvalidSymbolTableError(ValueError):
617
"""
7-
This exception being raised indicates that the symbol table and/or padding
8-
symbol supplied to an encoding/decoding operation are invalid.
18+
This exception is raised when the symbol table and/or padding symbol
19+
supplied to an encoding/decoding operation are invalid.
920
"""
1021
pass

tests/core/test_encode_decode_raw.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +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
1213

1314

1415
@ddt
@@ -80,9 +81,9 @@ def test_encode_raw_invalid_input_ratio(
8081
input ratio. This is because such an action normally can be solved with
8182
padding, however padding can only be used successfully on the 'smaller'
8283
side of the transformation, in any other case data corruption occurs.
83-
If this is attempted, then ValueError should be raised.
84+
If this is attempted, then ImproperUsageError should be raised.
8485
"""
85-
with self.assertRaises(ValueError):
86+
with self.assertRaises(ImproperUsageError):
8687
encode_raw(
8788
input_base=input_base, output_base=output_base,
8889
input_ratio=input_ratio, output_ratio=output_ratio,

0 commit comments

Comments
 (0)