|
1 | 1 | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2 |
| -# |
| 2 | +# |
3 | 3 | # Licensed under the Apache License, Version 2.0 (the "License").
|
4 | 4 | # You may not use this file except in compliance with the License.
|
5 | 5 | # A copy of the License is located at
|
6 |
| -# |
| 6 | +# |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0
|
8 |
| -# |
9 |
| -# or in the "license" file accompanying this file. This file is distributed |
10 |
| -# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
11 |
| -# express or implied. See the License for the specific language governing |
| 8 | +# |
| 9 | +# or in the "license" file accompanying this file. This file is distributed |
| 10 | +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 11 | +# express or implied. See the License for the specific language governing |
12 | 12 | # permissions and limitations under the License.
|
13 | 13 |
|
14 | 14 | import json
|
|
18 | 18 | from test.unit.utils import mock_import_modules
|
19 | 19 | from types import ModuleType
|
20 | 20 |
|
| 21 | +from container_support.serving import UnsupportedAcceptTypeError, UnsupportedContentTypeError |
| 22 | + |
21 | 23 | JSON_CONTENT_TYPE = "application/json"
|
22 | 24 |
|
23 | 25 |
|
@@ -279,6 +281,20 @@ def test_wait_model_to_load(proxy_client, serve):
|
279 | 281 | client.cache_prediction_metadata.assert_called_once_with()
|
280 | 282 |
|
281 | 283 |
|
| 284 | +def test_transformer_default_output_fn_unsupported_type(serve): |
| 285 | + accept_type = 'fake/accept-type' |
| 286 | + |
| 287 | + with pytest.raises(UnsupportedAcceptTypeError): |
| 288 | + serve.Transformer._default_output_fn(None, accept_type) |
| 289 | + |
| 290 | + |
| 291 | +def test_transformer_default_input_fn_unsupported_type(serve): |
| 292 | + content_type = 'fake/content-type' |
| 293 | + |
| 294 | + with pytest.raises(UnsupportedContentTypeError): |
| 295 | + serve.Transformer(None)._default_input_fn(None, content_type) |
| 296 | + |
| 297 | + |
282 | 298 | class DummyTransformer(object):
|
283 | 299 | def transform(self, content, mimetype):
|
284 | 300 | if content.startswith('500'):
|
|
0 commit comments