aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/ffmpeg/decode_audio_op_test.py
diff options
context:
space:
mode:
authorGravatar Justine Tunney <jart@google.com>2016-12-29 22:46:24 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-12-29 23:06:59 -0800
commite121667dc609de978a223c56ee906368d2c4ceef (patch)
tree7d4e1f1e1b4fd469487872c0cd34ddace5ac570c /tensorflow/contrib/ffmpeg/decode_audio_op_test.py
parent7815fcba7767aa1eb3196c5861e174f8b3c43bab (diff)
Remove so many more hourglass imports
Change: 143230429
Diffstat (limited to 'tensorflow/contrib/ffmpeg/decode_audio_op_test.py')
-rw-r--r--tensorflow/contrib/ffmpeg/decode_audio_op_test.py34
1 files changed, 19 insertions, 15 deletions
diff --git a/tensorflow/contrib/ffmpeg/decode_audio_op_test.py b/tensorflow/contrib/ffmpeg/decode_audio_op_test.py
index 6e85d360cc..e4ed46b1e2 100644
--- a/tensorflow/contrib/ffmpeg/decode_audio_op_test.py
+++ b/tensorflow/contrib/ffmpeg/decode_audio_op_test.py
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# =============================================================================
-
"""Tests for third_party.tensorflow.contrib.ffmpeg.decode_audio_op."""
from __future__ import absolute_import
@@ -21,13 +20,12 @@ from __future__ import print_function
import os.path
-import tensorflow as tf
-
from tensorflow.contrib import ffmpeg
from tensorflow.python.platform import resource_loader
+from tensorflow.python.platform import test
-class DecodeAudioOpTest(tf.test.TestCase):
+class DecodeAudioOpTest(test.TestCase):
def _loadFileAndTest(self, filename, file_format, duration_sec,
samples_per_second, channel_count):
@@ -41,20 +39,23 @@ class DecodeAudioOpTest(tf.test.TestCase):
channel_count: The desired channel count in the output tensor.
"""
with self.test_session():
- path = os.path.join(
- resource_loader.get_data_files_path(), 'testdata', filename)
+ path = os.path.join(resource_loader.get_data_files_path(), 'testdata',
+ filename)
with open(path, 'rb') as f:
contents = f.read()
audio_op = ffmpeg.decode_audio(
- contents, file_format=file_format,
- samples_per_second=samples_per_second, channel_count=channel_count)
+ contents,
+ file_format=file_format,
+ samples_per_second=samples_per_second,
+ channel_count=channel_count)
audio = audio_op.eval()
self.assertEqual(len(audio.shape), 2)
- self.assertNear(duration_sec * samples_per_second,
- audio.shape[0],
- # Duration should be specified within 10%:
- 0.1 * audio.shape[0])
+ self.assertNear(
+ duration_sec * samples_per_second,
+ audio.shape[0],
+ # Duration should be specified within 10%:
+ 0.1 * audio.shape[0])
self.assertEqual(audio.shape[1], channel_count)
def testMonoMp3(self):
@@ -95,11 +96,14 @@ class DecodeAudioOpTest(tf.test.TestCase):
def testInvalidFile(self):
with self.test_session():
contents = 'invalid file'
- audio_op = ffmpeg.decode_audio(contents, file_format='wav',
- samples_per_second=10000, channel_count=2)
+ audio_op = ffmpeg.decode_audio(
+ contents,
+ file_format='wav',
+ samples_per_second=10000,
+ channel_count=2)
audio = audio_op.eval()
self.assertEqual(audio.shape, (0, 0))
if __name__ == '__main__':
- tf.test.main()
+ test.main()