Skip to content

Commit

Permalink
Add test for empty image properties annotation.
Browse files Browse the repository at this point in the history
  • Loading branch information
daspecster committed Jan 20, 2017
1 parent 8809f2f commit 9d40edb
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions vision/unit_tests/test_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_rgb_color_data(self):
self.assertEqual(colors.blue, 255.0)
self.assertEqual(colors.alpha, 0.5)

def test_pb_no_rgb_color_data(self):
def test_empty_pb_rgb_color_data(self):
from google.type.color_pb2 import Color

color_pb = Color()
Expand Down Expand Up @@ -94,7 +94,7 @@ def _get_target_class():
from google.cloud.vision.color import ImagePropertiesAnnotation
return ImagePropertiesAnnotation

def test_color_annotation_from_pb(self):
def test_image_properties_annotation_from_pb(self):
from google.cloud.grpc.vision.v1 import image_annotator_pb2
from google.protobuf.wrappers_pb2 import FloatValue
from google.type.color_pb2 import Color
Expand All @@ -119,3 +119,12 @@ def test_color_annotation_from_pb(self):
self.assertEqual(image_properties.colors[0].color.green, 2.0)
self.assertEqual(image_properties.colors[0].color.blue, 3.0)
self.assertEqual(image_properties.colors[0].color.alpha, 1.0)

def test_empty_image_properties_annotation_from_pb(self):
from google.cloud.grpc.vision.v1 import image_annotator_pb2

image_properties_pb = image_annotator_pb2.ImageProperties()

color_info = self._get_target_class()
image_properties = color_info.from_pb(image_properties_pb)
self.assertIsNone(image_properties)

0 comments on commit 9d40edb

Please sign in to comment.