Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions vision/unit_tests/test__gax.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@

def _make_credentials():
import google.auth.credentials

return mock.Mock(spec=google.auth.credentials.Credentials)


class TestGAXClient(unittest.TestCase):
def _get_target_class(self):
from google.cloud.vision._gax import _GAPICVisionAPI

return _GAPICVisionAPI

def _make_one(self, *args, **kwargs):
Expand All @@ -40,6 +42,7 @@ def test_ctor(self):
def test_gapic_credentials(self):
from google.cloud.gapic.vision.v1.image_annotator_client import (
ImageAnnotatorClient)

from google.cloud.vision import Client

# Mock the GAPIC ImageAnnotatorClient, whose arguments we
Expand Down Expand Up @@ -214,8 +217,8 @@ def test_annotate_with_pb_requests_results(self):
responses = gax_api.annotate(requests_pb=[request])

self.assertEqual(len(responses), 2)
self.assertIsInstance(responses[0], Annotations)
self.assertIsInstance(responses[1], Annotations)
for annotation in responses:
self.assertIsInstance(annotation, Annotations)
gax_api._annotator_client.batch_annotate_images.assert_called()


Expand All @@ -239,6 +242,7 @@ def test__to_gapic_feature(self):
class Test__to_gapic_image(unittest.TestCase):
def _call_fut(self, image):
from google.cloud.vision._gax import _to_gapic_image

return _to_gapic_image(image)

def test__to_gapic_image_content(self):
Expand Down
3 changes: 3 additions & 0 deletions vision/unit_tests/test__http.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class TestConnection(unittest.TestCase):
@staticmethod
def _get_target_class():
from google.cloud.vision._http import Connection

return Connection

def _make_one(self, *args, **kw):
Expand Down Expand Up @@ -72,6 +73,7 @@ def test_extra_headers(self):
class Test_HTTPVisionAPI(unittest.TestCase):
def _get_target_class(self):
from google.cloud.vision._http import _HTTPVisionAPI

return _HTTPVisionAPI

def _make_one(self, *args, **kwargs):
Expand Down Expand Up @@ -172,6 +174,7 @@ class TestVisionRequest(unittest.TestCase):
@staticmethod
def _get_target_function():
from google.cloud.vision._http import _make_request

return _make_request

def _call_fut(self, *args, **kw):
Expand Down
2 changes: 2 additions & 0 deletions vision/unit_tests/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def test_it(self):
class Test__make_faces_from_pb(unittest.TestCase):
def _call_fut(self, annotations):
from google.cloud.vision.annotations import _make_faces_from_pb

return _make_faces_from_pb(annotations)

def test_it(self):
Expand All @@ -144,6 +145,7 @@ class Test__make_image_properties_from_pb(unittest.TestCase):
def _call_fut(self, annotations):
from google.cloud.vision.annotations import (
_make_image_properties_from_pb)

return _make_image_properties_from_pb(annotations)

def test_it(self):
Expand Down
1 change: 1 addition & 0 deletions vision/unit_tests/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

def _make_credentials():
import google.auth.credentials

return mock.Mock(spec=google.auth.credentials.Credentials)


Expand Down
Loading