# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree. """Unit tests for the test_data_generation module. """ import os import shutil import tempfile import unittest import numpy as np import scipy.io from . import test_data_generation from . import test_data_generation_factory from . import signal_processing class TestTestDataGenerators(unittest.TestCase): """Unit tests for the test_data_generation module. """ def setUp(self): """Create temporary folders.""" self._base_output_path = tempfile.mkdtemp() self._test_data_cache_path = tempfile.mkdtemp() self._fake_air_db_path = tempfile.mkdtemp() # Fake AIR DB impulse responses. # TODO(alessiob): ReverberationTestDataGenerator will change to allow custom # impulse responses. When changed, the coupling below between # impulse_response_mat_file_names and # ReverberationTestDataGenerator._IMPULSE_RESPONSES can be removed. impulse_response_mat_file_names = [ 'air_binaural_lecture_0_0_1.mat', 'air_binaural_booth_0_0_1.mat', ] for impulse_response_mat_file_name in impulse_response_mat_file_names: data = {'h_air': np.random.rand(1, 1000).astype('