File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 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+
516class 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
Original file line number Diff line number Diff line change 99from ddt import data , ddt , unpack
1010
1111from 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 ,
You can’t perform that action at this time.
0 commit comments