Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 5b8929b

Browse files
authored
samples: fixed flaky test (#57)
1 parent 3e8bd49 commit 5b8929b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

samples/snippets/hybrid_glossaries/hybrid_tutorial.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def pic_to_text(infile):
5656
# For less dense text, use text_detection
5757
response = client.document_text_detection(image=image)
5858
text = response.full_text_annotation.text
59+
print("Detected text: {}".format(text))
5960

6061
return text
6162
# [END translate_hybrid_vision]

samples/snippets/hybrid_glossaries/hybrid_tutorial_test.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
import os
16-
import re
1716
import sys
1817
import uuid
1918

@@ -29,11 +28,13 @@
2928
# VISION TESTS
3029

3130

32-
def test_vision_standard_format():
31+
def test_vision_standard_format(capsys):
3332
# Generate text using Vision API
34-
text = pic_to_text('resources/standard_format.jpeg')
33+
pic_to_text('resources/standard_format.jpeg')
34+
out, err = capsys.readouterr()
3535

36-
assert re.match(r"This\s?is\s?a\s?test!\s?", text)
36+
assert 'Detected text:' in out
37+
assert 'test!' in out
3738

3839

3940
def test_vision_non_standard_format():

0 commit comments

Comments
 (0)