def test_log_data_audio(self):
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.AUDIO)) is False)
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.AUDIO)) is False)
    with patch('polyaxon.tracking.run.Run._log_has_events') as log_audio:
        self.run.log_audio(name='my_audio', data=tensor_np(shape=(42,)))
    assert (log_audio.call_count == 1)
    self.event_logger.flush()
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.AUDIO)) is True)
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.AUDIO)) is True)
    events_file = get_event_path(self.run_path, kind=V1ArtifactKind.AUDIO, name='my_audio')
    assert (os.path.exists(events_file) is True)
    results = V1Events.read(kind='audio', name='my_audio', data=events_file)
    assert (len(results.df.values) == 1)
    asset_file = get_asset_path(self.run_path, kind=V1ArtifactKind.AUDIO, name='my_audio', ext='wav')
    assert (os.path.exists(asset_file) is True)
def test_log_data_audio(self):
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.AUDIO)) is False)
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.AUDIO)) is False)
    with patch('polyaxon.tracking.run.Run._log_has_events') as log_audio:
        self.run.log_audio(name='my_audio', data=tensor_np(shape=(42,)))
    assert (log_audio.call_count == 1)
    self.event_logger.flush()
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.AUDIO)) is True)
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.AUDIO)) is True)
    events_file = get_event_path(self.run_path, kind=V1ArtifactKind.AUDIO, name='my_audio')
    assert (os.path.exists(events_file) is True)
    results = V1Events.read(kind='audio', name='my_audio', data=events_file)
    assert (len(results.df.values) == 1)
    asset_file = get_asset_path(self.run_path, kind=V1ArtifactKind.AUDIO, name='my_audio', ext='wav')
    assert (os.path.exists(asset_file) is True)