# Lint as: python3
"""Tests for spectral."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import tensorflow as tf
import os

import spectral


class SpectralTest(tf.test.TestCase):

    def test_give_me_a_name(self):
        pass


if __name__ == '__main__':
    os.environ["CUDA_VISIBLE_DEVICES"] = ''
    tf.test.main()

@@ -173,16 +173,35 @@
 w as tf%0A
+import numpy as np%0A
 import o
@@ -202,16 +202,16 @@
 port os%0A
-
 %0Aimport 
@@ -277,42 +277,1496 @@
 est_
-give_me_a_name(self):%0A        pass
+waveform_to_spectogram_shape(self):%0A        waveform = np.random.normal(size=(2**14,))%0A        spectogram = spectral.waveform_2_spectogram(waveform, frame_length=512, frame_step=128)%0A        %0A        self.assertEqual((128, 256, 2), spectogram.shape)%0A        %0A    def test_waveform_to_magnitude_shape(self):%0A        waveform = np.random.normal(size=(2**14,))%0A        magnitude = spectral.waveform_2_magnitude(waveform, frame_length=512, frame_step=128)%0A        %0A        self.assertEqual((128, 256), magnitude.shape)%0A        %0A    def test_waveform_to_spectogram_return(self):%0A        waveform = np.random.normal(size=(2**14,))%0A        spectogram = spectral.waveform_2_spectogram(waveform, frame_length=512, frame_step=128)%0A        waveform_hat = spectral.spectogram_2_waveform(spectogram, frame_length=512, frame_step=128)%0A        %0A        # Account for extra samples from reverse transform%0A        waveform_hat = waveform%5B0:len(waveform)%5D%0A        %0A        self.assertAllClose(waveform, waveform_hat)%0A        %0A    def test_waveform_to_magnitude_return(self):%0A        waveform = np.random.normal(size=(2**14,))%0A        spectogram = spectral.waveform_2_magnitude(waveform, frame_length=512, frame_step=128)%0A        waveform_hat = spectral.magnitude_2_waveform(spectogram, frame_length=512, frame_step=128)%0A        %0A        # Account for extra samples from reverse transform%0A        waveform_hat = waveform%5B0:len(waveform)%5D%0A        %0A        self.assertAllClose(waveform, waveform_hat)%0A        
 %0A%0A%0Ai

Work on utils/spectral Tests