Skip to content

Commit 58e48d9

Browse files
committed
Update vision acceptance tests
Loosen the numeric tests to they can handle some variability in the service.
1 parent d397b69 commit 58e48d9

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

google-cloud-vision/acceptance/vision/vision_test.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@
129129

130130
face.features.wont_be :nil?
131131

132-
face.features.confidence.must_be_close_to 0.42813218
132+
face.features.confidence.must_be_close_to 0.4, 0.1
133133
face.features.chin.center.must_be_kind_of Google::Cloud::Vision::Annotation::Face::Features::Landmark
134-
face.features.chin.center.x.must_be_close_to 233.21977
135-
face.features.chin.center.y.must_be_close_to 189.47475
136-
face.features.chin.center.z.must_be_close_to 19.487228
134+
face.features.chin.center.x.must_be_close_to 233.2, 0.1
135+
face.features.chin.center.y.must_be_close_to 189.4, 0.1
136+
face.features.chin.center.z.must_be_close_to 19.4, 0.1
137137
face.features.chin.left.to_a.must_be_close_to_array [166.70468, 145.37173, 71.187653]
138138
face.features.chin.right.to_a.must_be_close_to_array [299.02509, 135.58951, 61.98719]
139139

@@ -244,7 +244,7 @@
244244
landmark.mid.must_equal "/m/019dvv"
245245
landmark.locale.must_be :empty?
246246
landmark.description.must_equal "Mount Rushmore"
247-
landmark.score.must_be_close_to 0.917461633682251
247+
landmark.score.must_be_close_to 0.9, 0.1
248248
landmark.confidence.must_be :zero?
249249
landmark.topicality.must_be :zero?
250250
landmark.bounds[0].must_be_kind_of Google::Cloud::Vision::Annotation::Vertex
@@ -254,8 +254,8 @@
254254
landmark.bounds[2].to_a.must_equal [478, 319]
255255
landmark.bounds[3].to_a.must_equal [9, 319]
256256
landmark.locations[0].must_be_kind_of Google::Cloud::Vision::Location
257-
landmark.locations[0].latitude.must_be_close_to 43.878264
258-
landmark.locations[0].longitude.must_be_close_to -103.45700740814209
257+
landmark.locations[0].latitude.must_be_close_to 43.8, 0.1
258+
landmark.locations[0].longitude.must_be_close_to -103.4, 0.1
259259
landmark.properties.must_be :empty?
260260
end
261261

@@ -299,7 +299,7 @@
299299
logo.mid.must_equal "/m/0b34hf"
300300
logo.locale.must_be :empty?
301301
logo.description.must_equal "Google"
302-
logo.score.must_be_close_to 0.7072761058807373
302+
logo.score.must_be_close_to 0.7, 0.1
303303
logo.confidence.must_be :zero?
304304
logo.topicality.must_be :zero?
305305
logo.bounds[0].must_be_kind_of Google::Cloud::Vision::Annotation::Vertex
@@ -656,16 +656,16 @@
656656
annotation.properties.colors[0].blue.must_equal 254
657657
annotation.properties.colors[0].alpha.must_equal 1.0
658658
annotation.properties.colors[0].rgb.must_equal "91c1fe"
659-
annotation.properties.colors[0].score.must_be_close_to 0.65757853
660-
annotation.properties.colors[0].pixel_fraction.must_be_close_to 0.16903226
659+
annotation.properties.colors[0].score.must_be_close_to 0.6, 0.1
660+
annotation.properties.colors[0].pixel_fraction.must_be_close_to 0.1, 0.1
661661

662662
annotation.properties.colors[9].red.must_equal 156
663663
annotation.properties.colors[9].green.must_equal 214
664664
annotation.properties.colors[9].blue.must_equal 255
665665
annotation.properties.colors[9].alpha.must_equal 1.0
666666
annotation.properties.colors[9].rgb.must_equal "9cd6ff"
667-
annotation.properties.colors[9].score.must_be_close_to 0.00096750073
668-
annotation.properties.colors[9].pixel_fraction.must_be_close_to 0.00064516132
667+
annotation.properties.colors[9].score.must_be_close_to 0.0, 0.1
668+
annotation.properties.colors[9].pixel_fraction.must_be_close_to 0.0, 0.1
669669
end
670670

671671
it "detects properties from multiple images" do
@@ -917,16 +917,16 @@
917917
properties.colors[0].blue.must_equal 254
918918
properties.colors[0].alpha.must_equal 1.0
919919
properties.colors[0].rgb.must_equal "91c1fe"
920-
properties.colors[0].score.must_be_close_to 0.65757853
921-
properties.colors[0].pixel_fraction.must_be_close_to 0.16903226
920+
properties.colors[0].score.must_be_close_to 0.6, 0.1
921+
properties.colors[0].pixel_fraction.must_be_close_to 0.1, 0.1
922922

923923
properties.colors[9].red.must_equal 156
924924
properties.colors[9].green.must_equal 214
925925
properties.colors[9].blue.must_equal 255
926926
properties.colors[9].alpha.must_equal 1.0
927927
properties.colors[9].rgb.must_equal "9cd6ff"
928-
properties.colors[9].score.must_be_close_to 0.00096750073
929-
properties.colors[9].pixel_fraction.must_be_close_to 0.00064516132
928+
properties.colors[9].score.must_be_close_to 0.0, 0.1
929+
properties.colors[9].pixel_fraction.must_be_close_to 0.0, 0.1
930930
end
931931
end
932932

0 commit comments

Comments
 (0)