File tree 4 files changed +29
-13
lines changed
packages/google-cloud-videointelligence/samples/analyze 4 files changed +29
-13
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,13 @@ def test_analyze_labels(capsys):
48
48
assert "label description: cat" in out
49
49
50
50
51
+ @pytest .mark .slow
52
+ def test_analyze_labels_file (capsys ):
53
+ analyze .analyze_labels_file ("resources/googlework_tiny.mp4" )
54
+ out , _ = capsys .readouterr ()
55
+ assert "label description" in out
56
+
57
+
51
58
@pytest .mark .slow
52
59
def test_analyze_explicit_content (capsys ):
53
60
analyze .analyze_explicit_content ("gs://cloud-samples-data/video/cat.mp4" )
@@ -75,8 +82,23 @@ def test_detect_text_gcs(capsys):
75
82
assert text_exists
76
83
77
84
85
+ @pytest .mark .slow
86
+ def test_detect_text (capsys ):
87
+ analyze .video_detect_text ("resources/googlework_tiny.mp4" )
88
+ out , _ = capsys .readouterr ()
89
+ assert 'Text' in out
90
+
91
+
78
92
@pytest .mark .slow
79
93
def test_track_objects_gcs (capsys ):
80
94
analyze .track_objects_gcs ("gs://cloud-samples-data/video/cat.mp4" )
81
95
out , _ = capsys .readouterr ()
82
96
assert "cat" in out
97
+
98
+
99
+ @pytest .mark .slow
100
+ def test_track_objects (capsys ):
101
+ in_file = "./resources/googlework_tiny.mp4"
102
+ analyze .track_objects (in_file )
103
+ out , _ = capsys .readouterr ()
104
+ assert "Entity id" in out
Original file line number Diff line number Diff line change @@ -152,17 +152,11 @@ def test_detect_text_gcs():
152
152
153
153
154
154
@pytest .mark .slow
155
- def test_track_objects ():
156
- in_file = "./resources/cat.mp4"
157
- object_annotations = beta_snippets .track_objects (in_file )
158
-
159
- text_exists = False
160
- for object_annotation in object_annotations :
161
- if "CAT" in object_annotation .entity .description .upper ():
162
- text_exists = True
163
- assert text_exists
164
- assert object_annotations [0 ].frames [0 ].normalized_bounding_box .left >= 0.0
165
- assert object_annotations [0 ].frames [0 ].normalized_bounding_box .left <= 1.0
155
+ def test_track_objects (capsys ):
156
+ in_file = "./resources/googlework_tiny.mp4"
157
+ beta_snippets .track_objects (in_file )
158
+ out , _ = capsys .readouterr ()
159
+ assert "Entity id" in out
166
160
167
161
168
162
@pytest .mark .slow
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ def test_sample_annotate_video(capsys):
26
26
27
27
out , _ = capsys .readouterr ()
28
28
29
- assert "Description : Google Maps " in out
29
+ assert "Description" in out
30
30
assert "Confidence" in out
31
31
assert "Start Time Offset" in out
32
32
assert "End Time Offset" in out
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ def test_sample_annotate_video(capsys):
26
26
27
27
out , _ = capsys .readouterr ()
28
28
29
- assert "Description : Google Maps " in out
29
+ assert "Description" in out
30
30
assert "Confidence" in out
31
31
assert "Start Time Offset" in out
32
32
assert "End Time Offset" in out
You can’t perform that action at this time.
0 commit comments