Skip to content

Commit c090fb5

Browse files
authored
Merge pull request #3082 from daspecster/vision-test-updates
Clean up Vision unit tests.
2 parents 44c5575 + 0c66f9f commit c090fb5

13 files changed

+265
-239
lines changed

vision/unit_tests/test__gax.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919

2020
def _make_credentials():
2121
import google.auth.credentials
22+
2223
return mock.Mock(spec=google.auth.credentials.Credentials)
2324

2425

2526
class TestGAXClient(unittest.TestCase):
2627
def _get_target_class(self):
2728
from google.cloud.vision._gax import _GAPICVisionAPI
29+
2830
return _GAPICVisionAPI
2931

3032
def _make_one(self, *args, **kwargs):
@@ -40,6 +42,7 @@ def test_ctor(self):
4042
def test_gapic_credentials(self):
4143
from google.cloud.gapic.vision.v1.image_annotator_client import (
4244
ImageAnnotatorClient)
45+
4346
from google.cloud.vision import Client
4447

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

216219
self.assertEqual(len(responses), 2)
217-
self.assertIsInstance(responses[0], Annotations)
218-
self.assertIsInstance(responses[1], Annotations)
220+
for annotation in responses:
221+
self.assertIsInstance(annotation, Annotations)
219222
gax_api._annotator_client.batch_annotate_images.assert_called()
220223

221224

@@ -239,6 +242,7 @@ def test__to_gapic_feature(self):
239242
class Test__to_gapic_image(unittest.TestCase):
240243
def _call_fut(self, image):
241244
from google.cloud.vision._gax import _to_gapic_image
245+
242246
return _to_gapic_image(image)
243247

244248
def test__to_gapic_image_content(self):

vision/unit_tests/test__http.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class TestConnection(unittest.TestCase):
2828
@staticmethod
2929
def _get_target_class():
3030
from google.cloud.vision._http import Connection
31+
3132
return Connection
3233

3334
def _make_one(self, *args, **kw):
@@ -72,6 +73,7 @@ def test_extra_headers(self):
7273
class Test_HTTPVisionAPI(unittest.TestCase):
7374
def _get_target_class(self):
7475
from google.cloud.vision._http import _HTTPVisionAPI
76+
7577
return _HTTPVisionAPI
7678

7779
def _make_one(self, *args, **kwargs):
@@ -172,6 +174,7 @@ class TestVisionRequest(unittest.TestCase):
172174
@staticmethod
173175
def _get_target_function():
174176
from google.cloud.vision._http import _make_request
177+
175178
return _make_request
176179

177180
def _call_fut(self, *args, **kw):

vision/unit_tests/test_annotations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def test_it(self):
128128
class Test__make_faces_from_pb(unittest.TestCase):
129129
def _call_fut(self, annotations):
130130
from google.cloud.vision.annotations import _make_faces_from_pb
131+
131132
return _make_faces_from_pb(annotations)
132133

133134
def test_it(self):
@@ -144,6 +145,7 @@ class Test__make_image_properties_from_pb(unittest.TestCase):
144145
def _call_fut(self, annotations):
145146
from google.cloud.vision.annotations import (
146147
_make_image_properties_from_pb)
148+
147149
return _make_image_properties_from_pb(annotations)
148150

149151
def test_it(self):

vision/unit_tests/test_batch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
def _make_credentials():
2323
import google.auth.credentials
24+
2425
return mock.Mock(spec=google.auth.credentials.Credentials)
2526

2627

0 commit comments

Comments
 (0)