|
25 | 25 | TargetStatusNotSuccess, |
26 | 26 | TargetStatusProcessing, |
27 | 27 | UnknownTarget, |
| 28 | + UnknownVWSErrorPossiblyBadName, |
28 | 29 | ) |
29 | 30 |
|
30 | 31 |
|
@@ -52,6 +53,17 @@ def test_invalid_given_id(vws_client: VWS) -> None: |
52 | 53 | assert exc.value.response.status_code == codes.NOT_FOUND |
53 | 54 |
|
54 | 55 |
|
| 56 | +def test_add_bad_name(vws_client: VWS, high_quality_image: io.BytesIO) -> None: |
| 57 | + """ |
| 58 | + When a name with a bad character is given, an |
| 59 | + ``UnknownVWSErrorPossiblyBadName`` exception is raised. |
| 60 | + """ |
| 61 | + max_char_value = 65535 |
| 62 | + bad_name = chr(max_char_value + 1) |
| 63 | + with pytest.raises(UnknownVWSErrorPossiblyBadName): |
| 64 | + vws_client.add_target(name=bad_name, width=1, image=high_quality_image) |
| 65 | + |
| 66 | + |
55 | 67 | def test_request_quota_reached() -> None: |
56 | 68 | """ |
57 | 69 | See https://github.com/adamtheturtle/vws-python/issues/822 for writing |
@@ -262,20 +274,14 @@ def test_match_processing( |
262 | 274 | high_quality_image: io.BytesIO, |
263 | 275 | ) -> None: |
264 | 276 | """ |
265 | | - A ``MatchProcessing`` exception is raised when a deleted target is matched. |
| 277 | + A ``MatchProcessing`` exception is raised when a target in processing is |
| 278 | + matched. |
266 | 279 | """ |
267 | | - target_id = vws_client.add_target( |
| 280 | + vws_client.add_target( |
268 | 281 | name='x', |
269 | 282 | width=1, |
270 | 283 | image=high_quality_image, |
271 | 284 | ) |
272 | 285 | with pytest.raises(MatchProcessing) as exc: |
273 | 286 | cloud_reco_client.query(image=high_quality_image) |
274 | 287 | assert exc.value.response.status_code == codes.INTERNAL_SERVER_ERROR |
275 | | - vws_client.wait_for_target_processed(target_id=target_id) |
276 | | - cloud_reco_client.query(image=high_quality_image) |
277 | | - vws_client.delete_target(target_id=target_id) |
278 | | - with pytest.raises(MatchProcessing) as exc: |
279 | | - cloud_reco_client.query(image=high_quality_image) |
280 | | - |
281 | | - assert exc.value.response.status_code == codes.INTERNAL_SERVER_ERROR |
|
0 commit comments