Skip to content

Commit 4666666

Browse files
committed
added test
1 parent 369069b commit 4666666

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/unit/test_decoder_encoder.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
import json
15-
15+
import pytest
1616
from sagemaker_huggingface_inference_toolkit import decoder_encoder
17+
from mms.service import PredictionException
1718

1819

1920
ENCODE_JSON_INPUT = {"upper": [1425], "lower": [576], "level": [2], "datetime": ["2012-08-08 15:30"]}
@@ -46,6 +47,13 @@ def test_decode_csv():
4647
assert decoded_data == {"inputs": ["I love you", "I like you"]}
4748

4849

50+
def test_decode_csv_without_header():
51+
with pytest.raises(PredictionException):
52+
decoder_encoder.decode_csv(
53+
"where do i live?,My name is Philipp and I live in Nuremberg\r\nwhere is Berlin?,Berlin is the capital of Germany"
54+
)
55+
56+
4957
def test_encode_json():
5058
encoded_data = decoder_encoder.encode_json(ENCODE_JSON_INPUT)
5159
assert json.loads(encoded_data) == ENCODE_JSON_INPUT

0 commit comments

Comments
 (0)