Skip to content

Commit

Permalink
samples: fixed flaky test (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
munkhuushmgl authored Aug 31, 2020
1 parent 90879c5 commit cd626e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def pic_to_text(infile):
# For less dense text, use text_detection
response = client.document_text_detection(image=image)
text = response.full_text_annotation.text
print("Detected text: {}".format(text))

return text
# [END translate_hybrid_vision]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import os
import re
import sys
import uuid

Expand All @@ -29,11 +28,13 @@
# VISION TESTS


def test_vision_standard_format():
def test_vision_standard_format(capsys):
# Generate text using Vision API
text = pic_to_text('resources/standard_format.jpeg')
pic_to_text('resources/standard_format.jpeg')
out, err = capsys.readouterr()

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


def test_vision_non_standard_format():
Expand Down

0 comments on commit cd626e7

Please sign in to comment.