File tree Expand file tree Collapse file tree 4 files changed +29
-13
lines changed
packages/google-cloud-videointelligence/samples/analyze Expand file tree Collapse file tree 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):
4848 assert "label description: cat" in out
4949
5050
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+
5158@pytest .mark .slow
5259def test_analyze_explicit_content (capsys ):
5360 analyze .analyze_explicit_content ("gs://cloud-samples-data/video/cat.mp4" )
@@ -75,8 +82,23 @@ def test_detect_text_gcs(capsys):
7582 assert text_exists
7683
7784
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+
7892@pytest .mark .slow
7993def test_track_objects_gcs (capsys ):
8094 analyze .track_objects_gcs ("gs://cloud-samples-data/video/cat.mp4" )
8195 out , _ = capsys .readouterr ()
8296 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():
152152
153153
154154@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
166160
167161
168162@pytest .mark .slow
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ def test_sample_annotate_video(capsys):
2626
2727 out , _ = capsys .readouterr ()
2828
29- assert "Description : Google Maps " in out
29+ assert "Description" in out
3030 assert "Confidence" in out
3131 assert "Start Time Offset" in out
3232 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):
2626
2727 out , _ = capsys .readouterr ()
2828
29- assert "Description : Google Maps " in out
29+ assert "Description" in out
3030 assert "Confidence" in out
3131 assert "Start Time Offset" in out
3232 assert "End Time Offset" in out
You can’t perform that action at this time.
0 commit comments