Skip to content

Commit

Permalink
test fixes for google video
Browse files Browse the repository at this point in the history
  • Loading branch information
qmac committed Apr 18, 2018
1 parent db20fd5 commit 96d7558
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pliers/converters/api/ibm.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def check_valid_keys(self):
self._send_request(request)
return True
except Exception as e:
if 'Unauthorized' in str(e):
if 'Not Authorized' in str(e):
return False
else:
raise e
Expand Down
2 changes: 1 addition & 1 deletion pliers/extractors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def to_df(self, timing=True, metadata=False, format='wide',
df.insert(0, 'onset', onsets)
df.insert(0, 'duration', durations)
df.insert(0, 'order', orders)
df = df.sort_values('onset')
df = df.sort_values('onset').reset_index(drop=True)
index_cols.extend(['onset', 'order', 'duration'])

if format == 'long':
Expand Down
3 changes: 2 additions & 1 deletion pliers/tests/extractors/api/test_google_extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def test_google_video_api_extractor2(caplog):
{'startTimeOffset': '0.3s', 'endTimeOffset': '0.4s'}]
ext = GoogleVideoIntelligenceAPIExtractor(timeout=500, segments=segments,
features=['EXPLICIT_CONTENT_DETECTION'])
stim = VideoStim(join(VIDEO_DIR, 'park.mp4'))
result = ext.transform(stim).to_df()
log_message = caplog.records[-1].message
incomplete = (log_message == ("The extraction reached the timeout limit of"
Expand Down Expand Up @@ -327,7 +328,7 @@ def test_google_video_api_explicit_extractor(caplog):
" %fs, which means the API may not have finished analyzing the"
" video and the results may be empty or incomplete." % 90))
if not incomplete:
assert result.shape[2] == 5
assert result.shape[1] == 5
assert result['onset'][0] >= 4.2
assert 'pornographyLikelihood' in result.columns
assert 'UNLIKELY' in result['pornographyLikelihood'][0]

0 comments on commit 96d7558

Please sign in to comment.