From 1c1e50d4f768bfa636825f94108dc3d02389dd28 Mon Sep 17 00:00:00 2001 From: Seth Hollyman Date: Wed, 6 Feb 2019 11:33:17 -0800 Subject: [PATCH 1/4] Vision API: further fixes. Redirects testing to the central cloud-samples-data asset bucket. Relaxes case considerations. Addresses web subtests, missed in previous PR. --- vision/cloud-client/detect/detect_test.py | 70 +++++++++++----------- vision/cloud-client/web/web_detect_test.py | 11 ++-- 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/vision/cloud-client/detect/detect_test.py b/vision/cloud-client/detect/detect_test.py index 588f86fec57..6e2e0272de5 100644 --- a/vision/cloud-client/detect/detect_test.py +++ b/vision/cloud-client/detect/detect_test.py @@ -18,7 +18,7 @@ import detect -BUCKET = os.environ['CLOUD_STORAGE_BUCKET'] +ASSET_BUCKET = "cloud-samples-data" OUTPUT_PREFIX = 'OCR_PDF_TEST_OUTPUT' GCS_SOURCE_URI = 'gs://{}/HodgeConj.pdf'.format(BUCKET) GCS_DESTINATION_URI = 'gs://{}/{}/'.format(BUCKET, OUTPUT_PREFIX) @@ -41,7 +41,7 @@ def test_labels_uri(capsys): def test_labels_http(capsys): - uri = 'https://storage-download.googleapis.com/{}/vision/wakeupcat.jpg' + uri = 'https://storage-download.googleapis.com/{}/vision/label/wakeupcat.jpg' detect.detect_labels_uri(uri.format(BUCKET)) out, _ = capsys.readouterr() assert 'Labels' in out @@ -53,21 +53,21 @@ def test_landmarks(capsys): 'resources/landmark.jpg') detect.detect_landmarks(file_name) out, _ = capsys.readouterr() - assert 'Palace' in out + assert 'palace' in out.lower() def test_landmarks_uri(capsys): file_name = 'gs://{}/vision/landmark.jpg'.format(BUCKET) detect.detect_landmarks_uri(file_name) out, _ = capsys.readouterr() - assert 'Palace' in out + assert 'palace' in out.lower() def test_landmarks_http(capsys): - uri = 'https://storage-download.googleapis.com/{}/vision/landmark.jpg' + uri = 'https://storage-download.googleapis.com/{}/vision/landmark/pofa.jpg' detect.detect_landmarks_uri(uri.format(BUCKET)) out, _ = capsys.readouterr() - assert 'Palace' in out + assert 'palace' in out.lower() def test_faces(capsys): @@ -80,7 +80,7 @@ def test_faces(capsys): def test_faces_uri(capsys): - file_name = 'gs://{}/vision/face_no_surprise.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/face/face_no_surprise.jpg'.format(BUCKET) detect.detect_faces_uri(file_name) out, _ = capsys.readouterr() assert 'POSSIBLE' in out @@ -88,7 +88,7 @@ def test_faces_uri(capsys): def test_faces_http(capsys): uri = ('https://storage-download.googleapis.com/{}/vision/' + - 'face_no_surprise.jpg') + 'face/face_no_surprise.jpg') detect.detect_faces_uri(uri.format(BUCKET)) out, _ = capsys.readouterr() assert 'POSSIBLE' in out @@ -100,21 +100,21 @@ def test_logos(capsys): 'resources/logos.png') detect.detect_logos(file_name) out, _ = capsys.readouterr() - assert 'google' in out + assert 'google' in out.lower() def test_logos_uri(capsys): - file_name = 'gs://{}/vision/logos.png'.format(BUCKET) + file_name = 'gs://{}/vision/logo/logo_google.png'.format(BUCKET) detect.detect_logos_uri(file_name) out, _ = capsys.readouterr() - assert 'google' in out + assert 'google' in out.lower() def test_logos_http(capsys): - uri = 'https://storage-download.googleapis.com/{}/vision/logos.png' + uri = 'https://storage-download.googleapis.com/{}/vision/logo/logo_google.png' detect.detect_logos_uri(uri.format(BUCKET)) out, _ = capsys.readouterr() - assert 'google' in out + assert 'google' in out.lower() def test_safe_search(capsys): @@ -128,7 +128,7 @@ def test_safe_search(capsys): def test_safe_search_uri(capsys): - file_name = 'gs://{}/vision/wakeupcat.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/label/wakeupcat.jpg'.format(BUCKET) detect.detect_safe_search_uri(file_name) out, _ = capsys.readouterr() assert 'VERY_LIKELY' in out @@ -136,7 +136,7 @@ def test_safe_search_uri(capsys): def test_safe_search_http(capsys): - uri = 'https://storage-download.googleapis.com/{}/vision/wakeupcat.jpg' + uri = 'https://storage-download.googleapis.com/{}/vision/label/wakeupcat.jpg' detect.detect_safe_search_uri(uri.format(BUCKET)) out, _ = capsys.readouterr() assert 'VERY_LIKELY' in out @@ -153,14 +153,14 @@ def test_detect_text(capsys): def test_detect_text_uri(capsys): - file_name = 'gs://{}/vision/text.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/text/screen.jpg'.format(BUCKET) detect.detect_text_uri(file_name) out, _ = capsys.readouterr() assert '37%' in out def test_detect_text_http(capsys): - uri = 'https://storage-download.googleapis.com/{}/vision/text.jpg' + uri = 'https://storage-download.googleapis.com/{}/vision/text/screen.jpg' detect.detect_text_uri(uri.format(BUCKET)) out, _ = capsys.readouterr() assert '37%' in out @@ -176,14 +176,14 @@ def test_detect_properties(capsys): def test_detect_properties_uri(capsys): - file_name = 'gs://{}/vision/landmark.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/landmark/pofa.jpg'.format(BUCKET) detect.detect_properties_uri(file_name) out, _ = capsys.readouterr() assert 'frac' in out def test_detect_properties_http(capsys): - uri = 'https://storage-download.googleapis.com/{}/vision/landmark.jpg' + uri = 'https://storage-download.googleapis.com/{}/vision/landmark/pofa.jpg' detect.detect_properties_uri(uri.format(BUCKET)) out, _ = capsys.readouterr() assert 'frac' in out @@ -196,21 +196,21 @@ def test_detect_web(capsys): 'resources/landmark.jpg') detect.detect_web(file_name) out, _ = capsys.readouterr() - assert 'Best guess label: palace of fine arts' in out + assert 'best guess label: palace of fine arts' in out.lower() def test_detect_web_uri(capsys): - file_name = 'gs://{}/vision/landmark.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/landmark/pofa.jpg'.format(BUCKET) detect.detect_web_uri(file_name) out, _ = capsys.readouterr() - assert 'Best guess label: palace of fine arts' in out + assert 'best guess label: palace of fine arts' in out.lower() def test_detect_web_http(capsys): - uri = 'https://storage-download.googleapis.com/{}/vision/landmark.jpg' + uri = 'https://storage-download.googleapis.com/{}/vision/landmark/pofa.jpg' detect.detect_web_uri(uri.format(BUCKET)) out, _ = capsys.readouterr() - assert 'Best guess label: palace of fine arts' in out + assert 'best guess label: palace of fine arts' in out.lower() def test_detect_web_with_geo(capsys): @@ -219,34 +219,36 @@ def test_detect_web_with_geo(capsys): 'resources/city.jpg') detect.web_entities_include_geo_results(file_name) out, _ = capsys.readouterr() - assert 'Zepra' in out or 'Electra Tower' in out + out = out.lower() + assert 'zepra' in out or 'electra tower' in out def test_detect_web_with_geo_uri(capsys): - file_name = 'gs://{}/vision/city.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/web/city.jpg'.format(BUCKET) detect.web_entities_include_geo_results_uri(file_name) out, _ = capsys.readouterr() - assert 'Zepra' in out or 'Electra Tower' in out + out = out.lower() + assert 'zepra' in out or 'electra Tower' in out def test_detect_document(capsys): file_name = os.path.join( os.path.dirname(__file__), - 'resources/text.jpg') + 'resources/text/screen.jpg') detect.detect_document(file_name) out, _ = capsys.readouterr() assert 'class' in out def test_detect_document_uri(capsys): - file_name = 'gs://{}/vision/text.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/text/screen.jpg'.format(BUCKET) detect.detect_document_uri(file_name) out, _ = capsys.readouterr() assert 'class' in out def test_detect_document_http(capsys): - uri = 'https://storage-download.googleapis.com/{}/vision/text.jpg' + uri = 'https://storage-download.googleapis.com/{}/vision/text/screen.jpg' detect.detect_document_uri(uri.format(BUCKET)) out, _ = capsys.readouterr() assert 'class' in out @@ -262,14 +264,14 @@ def test_detect_crop_hints(capsys): def test_detect_crop_hints_uri(capsys): - file_name = 'gs://{}/vision/wakeupcat.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/label/wakeupcat.jpg'.format(BUCKET) detect.detect_crop_hints_uri(file_name) out, _ = capsys.readouterr() assert 'bounds: (0,0)' in out def test_detect_crop_hints_http(capsys): - uri = 'https://storage-download.googleapis.com/{}/vision/wakeupcat.jpg' + uri = 'https://storage-download.googleapis.com/{}/vision/label/wakeupcat.jpg' detect.detect_crop_hints_uri(uri.format(BUCKET)) out, _ = capsys.readouterr() assert 'bounds: (0,0)' in out @@ -302,7 +304,7 @@ def test_localize_objects(capsys): detect.localize_objects('resources/puppies.jpg') out, _ = capsys.readouterr() - assert 'Dog' in out + assert 'dog' in out.lower() def test_localize_objects_uri(capsys): @@ -311,4 +313,4 @@ def test_localize_objects_uri(capsys): detect.localize_objects_uri(uri) out, _ = capsys.readouterr() - assert 'Dog' in out + assert 'dog' in out.lower() diff --git a/vision/cloud-client/web/web_detect_test.py b/vision/cloud-client/web/web_detect_test.py index 6b5553c97ae..083318420fd 100644 --- a/vision/cloud-client/web/web_detect_test.py +++ b/vision/cloud-client/web/web_detect_test.py @@ -16,22 +16,23 @@ import web_detect -BUCKET = os.environ['CLOUD_STORAGE_BUCKET'] +ASSET_BUCKET = "cloud-samples-data" def test_detect_file(capsys): file_name = ('../detect/resources/landmark.jpg') web_detect.report(web_detect.annotate(file_name)) out, _ = capsys.readouterr() - assert 'Description: Palace of Fine Arts Theatre' in out + print(out) + assert 'description: palace of fine arts' in out.lower() def test_detect_web_gsuri(capsys): - file_name = ('gs://{}/vision/landmark.jpg'.format( - BUCKET)) + file_name = ('gs://{}/vision/landmark/pofa.jpg'.format( + ASSET_BUCKET)) web_detect.report(web_detect.annotate(file_name)) out, _ = capsys.readouterr() - assert 'Description: Palace of Fine Arts Theatre' in out + assert 'description: palace of fine arts' in out.lower() def test_detect_web_http(capsys): From ffef3d8b19d81ceee4ee10895d50322668a5e2c0 Mon Sep 17 00:00:00 2001 From: Seth Hollyman Date: Wed, 6 Feb 2019 12:13:45 -0800 Subject: [PATCH 2/4] unused import --- vision/cloud-client/web/web_detect_test.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/vision/cloud-client/web/web_detect_test.py b/vision/cloud-client/web/web_detect_test.py index 083318420fd..3a0ea54840f 100644 --- a/vision/cloud-client/web/web_detect_test.py +++ b/vision/cloud-client/web/web_detect_test.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os - import web_detect ASSET_BUCKET = "cloud-samples-data" From b918ae3be4dd5e19d0989fda1e295e5c23faea45 Mon Sep 17 00:00:00 2001 From: Seth Hollyman Date: Wed, 6 Feb 2019 14:31:05 -0800 Subject: [PATCH 3/4] additional fixes, wire in cloud-samples-data into detect tests. --- vision/cloud-client/detect/detect_test.py | 55 ++++++++++++----------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/vision/cloud-client/detect/detect_test.py b/vision/cloud-client/detect/detect_test.py index 6e2e0272de5..499f46877a9 100644 --- a/vision/cloud-client/detect/detect_test.py +++ b/vision/cloud-client/detect/detect_test.py @@ -19,6 +19,8 @@ import detect ASSET_BUCKET = "cloud-samples-data" + +BUCKET = os.environ['CLOUD_STORAGE_BUCKET'] OUTPUT_PREFIX = 'OCR_PDF_TEST_OUTPUT' GCS_SOURCE_URI = 'gs://{}/HodgeConj.pdf'.format(BUCKET) GCS_DESTINATION_URI = 'gs://{}/{}/'.format(BUCKET, OUTPUT_PREFIX) @@ -34,7 +36,7 @@ def test_labels(capsys): def test_labels_uri(capsys): - file_name = 'gs://{}/vision/wakeupcat.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/wakeupcat.jpg'.format(ASSET_BUCKET) detect.detect_labels_uri(file_name) out, _ = capsys.readouterr() assert 'Labels' in out @@ -42,7 +44,7 @@ def test_labels_uri(capsys): def test_labels_http(capsys): uri = 'https://storage-download.googleapis.com/{}/vision/label/wakeupcat.jpg' - detect.detect_labels_uri(uri.format(BUCKET)) + detect.detect_labels_uri(uri.format(ASSET_BUCKET)) out, _ = capsys.readouterr() assert 'Labels' in out @@ -57,7 +59,7 @@ def test_landmarks(capsys): def test_landmarks_uri(capsys): - file_name = 'gs://{}/vision/landmark.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/landmark/pofa.jpg'.format(ASSET_BUCKET) detect.detect_landmarks_uri(file_name) out, _ = capsys.readouterr() assert 'palace' in out.lower() @@ -65,7 +67,7 @@ def test_landmarks_uri(capsys): def test_landmarks_http(capsys): uri = 'https://storage-download.googleapis.com/{}/vision/landmark/pofa.jpg' - detect.detect_landmarks_uri(uri.format(BUCKET)) + detect.detect_landmarks_uri(uri.format(ASSET_BUCKET)) out, _ = capsys.readouterr() assert 'palace' in out.lower() @@ -80,7 +82,7 @@ def test_faces(capsys): def test_faces_uri(capsys): - file_name = 'gs://{}/vision/face/face_no_surprise.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/face/face_no_surprise.jpg'.format(ASSET_BUCKET) detect.detect_faces_uri(file_name) out, _ = capsys.readouterr() assert 'POSSIBLE' in out @@ -89,7 +91,7 @@ def test_faces_uri(capsys): def test_faces_http(capsys): uri = ('https://storage-download.googleapis.com/{}/vision/' + 'face/face_no_surprise.jpg') - detect.detect_faces_uri(uri.format(BUCKET)) + detect.detect_faces_uri(uri.format(ASSET_BUCKET)) out, _ = capsys.readouterr() assert 'POSSIBLE' in out @@ -104,7 +106,7 @@ def test_logos(capsys): def test_logos_uri(capsys): - file_name = 'gs://{}/vision/logo/logo_google.png'.format(BUCKET) + file_name = 'gs://{}/vision/logo/logo_google.png'.format(ASSET_BUCKET) detect.detect_logos_uri(file_name) out, _ = capsys.readouterr() assert 'google' in out.lower() @@ -112,7 +114,7 @@ def test_logos_uri(capsys): def test_logos_http(capsys): uri = 'https://storage-download.googleapis.com/{}/vision/logo/logo_google.png' - detect.detect_logos_uri(uri.format(BUCKET)) + detect.detect_logos_uri(uri.format(ASSET_BUCKET)) out, _ = capsys.readouterr() assert 'google' in out.lower() @@ -128,7 +130,7 @@ def test_safe_search(capsys): def test_safe_search_uri(capsys): - file_name = 'gs://{}/vision/label/wakeupcat.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/label/wakeupcat.jpg'.format(ASSET_BUCKET) detect.detect_safe_search_uri(file_name) out, _ = capsys.readouterr() assert 'VERY_LIKELY' in out @@ -137,7 +139,7 @@ def test_safe_search_uri(capsys): def test_safe_search_http(capsys): uri = 'https://storage-download.googleapis.com/{}/vision/label/wakeupcat.jpg' - detect.detect_safe_search_uri(uri.format(BUCKET)) + detect.detect_safe_search_uri(uri.format(ASSET_BUCKET)) out, _ = capsys.readouterr() assert 'VERY_LIKELY' in out assert 'racy: ' in out @@ -153,7 +155,7 @@ def test_detect_text(capsys): def test_detect_text_uri(capsys): - file_name = 'gs://{}/vision/text/screen.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/text/screen.jpg'.format(ASSET_BUCKET) detect.detect_text_uri(file_name) out, _ = capsys.readouterr() assert '37%' in out @@ -161,7 +163,7 @@ def test_detect_text_uri(capsys): def test_detect_text_http(capsys): uri = 'https://storage-download.googleapis.com/{}/vision/text/screen.jpg' - detect.detect_text_uri(uri.format(BUCKET)) + detect.detect_text_uri(uri.format(ASSET_BUCKET)) out, _ = capsys.readouterr() assert '37%' in out @@ -176,7 +178,7 @@ def test_detect_properties(capsys): def test_detect_properties_uri(capsys): - file_name = 'gs://{}/vision/landmark/pofa.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/landmark/pofa.jpg'.format(ASSET_BUCKET) detect.detect_properties_uri(file_name) out, _ = capsys.readouterr() assert 'frac' in out @@ -184,7 +186,7 @@ def test_detect_properties_uri(capsys): def test_detect_properties_http(capsys): uri = 'https://storage-download.googleapis.com/{}/vision/landmark/pofa.jpg' - detect.detect_properties_uri(uri.format(BUCKET)) + detect.detect_properties_uri(uri.format(ASSET_BUCKET)) out, _ = capsys.readouterr() assert 'frac' in out @@ -200,7 +202,7 @@ def test_detect_web(capsys): def test_detect_web_uri(capsys): - file_name = 'gs://{}/vision/landmark/pofa.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/landmark/pofa.jpg'.format(ASSET_BUCKET) detect.detect_web_uri(file_name) out, _ = capsys.readouterr() assert 'best guess label: palace of fine arts' in out.lower() @@ -208,7 +210,7 @@ def test_detect_web_uri(capsys): def test_detect_web_http(capsys): uri = 'https://storage-download.googleapis.com/{}/vision/landmark/pofa.jpg' - detect.detect_web_uri(uri.format(BUCKET)) + detect.detect_web_uri(uri.format(ASSET_BUCKET)) out, _ = capsys.readouterr() assert 'best guess label: palace of fine arts' in out.lower() @@ -224,24 +226,24 @@ def test_detect_web_with_geo(capsys): def test_detect_web_with_geo_uri(capsys): - file_name = 'gs://{}/vision/web/city.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/web/city.jpg'.format(ASSET_BUCKET) detect.web_entities_include_geo_results_uri(file_name) out, _ = capsys.readouterr() out = out.lower() - assert 'zepra' in out or 'electra Tower' in out + assert 'zepra' in out or 'electra tower' in out def test_detect_document(capsys): file_name = os.path.join( os.path.dirname(__file__), - 'resources/text/screen.jpg') + 'resources/text.jpg') detect.detect_document(file_name) out, _ = capsys.readouterr() assert 'class' in out def test_detect_document_uri(capsys): - file_name = 'gs://{}/vision/text/screen.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/text/screen.jpg'.format(ASSET_BUCKET) detect.detect_document_uri(file_name) out, _ = capsys.readouterr() assert 'class' in out @@ -249,7 +251,7 @@ def test_detect_document_uri(capsys): def test_detect_document_http(capsys): uri = 'https://storage-download.googleapis.com/{}/vision/text/screen.jpg' - detect.detect_document_uri(uri.format(BUCKET)) + detect.detect_document_uri(uri.format(ASSET_BUCKET)) out, _ = capsys.readouterr() assert 'class' in out @@ -264,7 +266,7 @@ def test_detect_crop_hints(capsys): def test_detect_crop_hints_uri(capsys): - file_name = 'gs://{}/vision/label/wakeupcat.jpg'.format(BUCKET) + file_name = 'gs://{}/vision/label/wakeupcat.jpg'.format(ASSET_BUCKET) detect.detect_crop_hints_uri(file_name) out, _ = capsys.readouterr() assert 'bounds: (0,0)' in out @@ -272,7 +274,7 @@ def test_detect_crop_hints_uri(capsys): def test_detect_crop_hints_http(capsys): uri = 'https://storage-download.googleapis.com/{}/vision/label/wakeupcat.jpg' - detect.detect_crop_hints_uri(uri.format(BUCKET)) + detect.detect_crop_hints_uri(uri.format(ASSET_BUCKET)) out, _ = capsys.readouterr() assert 'bounds: (0,0)' in out @@ -286,13 +288,14 @@ def test_async_detect_document(capsys): assert len(list(bucket.list_blobs(prefix=OUTPUT_PREFIX))) == 0 + uri = 'gs://{}/vision/document/custom_0773375000.pdf'.format(ASSET_BUCKET) detect.async_detect_document( - gcs_source_uri=GCS_SOURCE_URI, + gcs_source_uri=uri, gcs_destination_uri=GCS_DESTINATION_URI) out, _ = capsys.readouterr() - assert 'Hodge conjecture' in out - assert len(list(bucket.list_blobs(prefix=OUTPUT_PREFIX))) == 3 + assert 'OIL, GAS AND MINERAL LEASE' in out + assert len(list(bucket.list_blobs(prefix=OUTPUT_PREFIX))) > 0 for blob in bucket.list_blobs(prefix=OUTPUT_PREFIX): blob.delete() From 653388c66d0b72db81b97a6923aadbc84419fee4 Mon Sep 17 00:00:00 2001 From: Seth Hollyman Date: Wed, 6 Feb 2019 14:42:49 -0800 Subject: [PATCH 4/4] line linelen --- vision/cloud-client/detect/detect_test.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/vision/cloud-client/detect/detect_test.py b/vision/cloud-client/detect/detect_test.py index 499f46877a9..9f8c9f4f3cb 100644 --- a/vision/cloud-client/detect/detect_test.py +++ b/vision/cloud-client/detect/detect_test.py @@ -43,7 +43,8 @@ def test_labels_uri(capsys): def test_labels_http(capsys): - uri = 'https://storage-download.googleapis.com/{}/vision/label/wakeupcat.jpg' + uri = 'https://storage-download.googleapis.com/{}' \ + '/vision/label/wakeupcat.jpg' detect.detect_labels_uri(uri.format(ASSET_BUCKET)) out, _ = capsys.readouterr() assert 'Labels' in out @@ -113,7 +114,8 @@ def test_logos_uri(capsys): def test_logos_http(capsys): - uri = 'https://storage-download.googleapis.com/{}/vision/logo/logo_google.png' + uri = 'https://storage-download.googleapis.com/{}' \ + '/vision/logo/logo_google.png' detect.detect_logos_uri(uri.format(ASSET_BUCKET)) out, _ = capsys.readouterr() assert 'google' in out.lower() @@ -138,7 +140,8 @@ def test_safe_search_uri(capsys): def test_safe_search_http(capsys): - uri = 'https://storage-download.googleapis.com/{}/vision/label/wakeupcat.jpg' + uri = 'https://storage-download.googleapis.com/{}' \ + '/vision/label/wakeupcat.jpg' detect.detect_safe_search_uri(uri.format(ASSET_BUCKET)) out, _ = capsys.readouterr() assert 'VERY_LIKELY' in out @@ -273,7 +276,8 @@ def test_detect_crop_hints_uri(capsys): def test_detect_crop_hints_http(capsys): - uri = 'https://storage-download.googleapis.com/{}/vision/label/wakeupcat.jpg' + uri = 'https://storage-download.googleapis.com/{}' \ + '/vision/label/wakeupcat.jpg' detect.detect_crop_hints_uri(uri.format(ASSET_BUCKET)) out, _ = capsys.readouterr() assert 'bounds: (0,0)' in out