From 989024982434b362e5f8b7546578d448c7d58607 Mon Sep 17 00:00:00 2001 From: shahules786 Date: Mon, 26 Sep 2022 17:08:41 +0530 Subject: [PATCH] test inference --- tests/test_inference.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/test_inference.py diff --git a/tests/test_inference.py b/tests/test_inference.py new file mode 100644 index 0000000..303aa67 --- /dev/null +++ b/tests/test_inference.py @@ -0,0 +1,26 @@ +import pytest +import torch +import numpy as np + +from enhancer.inference import Inference + + +@pytest.mark.parametrize("audio",["tests/data/vctk/clean_testset_wav/p257_166.wav",torch.rand(1,2,48000)]) +def test_read_input(audio): + + read_audio = Inference.read_input(audio,48000,16000) + assert isinstance(read_audio,torch.Tensor) + assert read_audio.shape[0] == 1 + +def test_batchify(): + rand = torch.rand(1,1000) + batched_rand = Inference.batchify(rand, window_size = 100, step_size=100) + assert batched_rand.shape[0] == 12 + +def test_aggregate(): + rand = torch.rand(12,1,100) + agg_rand = Inference.aggreagate(data=rand,window_size=100,total_frames=1000,step_size=100) + assert agg_rand.shape[-1] == 1000 + + + \ No newline at end of file