Docstrings
This commit is contained in:
@@ -18,6 +18,11 @@ NORMALIZATION_FACTOR = 32768
|
||||
|
||||
@pytest.fixture
|
||||
def probe_audio_processor():
|
||||
"""_summary_
|
||||
|
||||
Returns:
|
||||
_type_: _description_
|
||||
"""
|
||||
return AudioProcessor(test_waveform, test_sr)
|
||||
|
||||
|
||||
@@ -26,6 +31,11 @@ def probe_audio_processor():
|
||||
|
||||
|
||||
def test_AudioProcessor_init(probe_audio_processor):
|
||||
"""_summary_
|
||||
|
||||
Args:
|
||||
probe_audio_processor (_type_): _description_
|
||||
"""
|
||||
assert isinstance(probe_audio_processor, AudioProcessor)
|
||||
assert probe_audio_processor.waveform.device == test_waveform.device
|
||||
assert torch.equal(probe_audio_processor.waveform, test_waveform)
|
||||
@@ -34,6 +44,8 @@ def test_AudioProcessor_init(probe_audio_processor):
|
||||
|
||||
|
||||
def test_cut():
|
||||
"""_summary_
|
||||
"""
|
||||
waveform = torch.Tensor(10, 3)
|
||||
sr = 16000
|
||||
start = 4
|
||||
@@ -57,11 +69,15 @@ def test_cut():
|
||||
|
||||
|
||||
def test_audio_processor_invalid_sr():
|
||||
"""_summary_
|
||||
"""
|
||||
with pytest.raises(ValueError):
|
||||
AudioProcessor(test_waveform, [44100,48000])
|
||||
|
||||
|
||||
def test_audio_processor_SAMPLE_RATE():
|
||||
"""_summary_
|
||||
"""
|
||||
probe_audio_processor = AudioProcessor(test_waveform)
|
||||
assert probe_audio_processor.sr == SAMPLE_RATE
|
||||
|
||||
|
||||
@@ -13,11 +13,21 @@ def diariser_instance():
|
||||
|
||||
|
||||
def test_Diariser_init(diariser_instance):
|
||||
"""_summary_
|
||||
|
||||
Args:
|
||||
diariser_instance (_type_): _description_
|
||||
"""
|
||||
assert diariser_instance.model == 'pyannote'
|
||||
|
||||
|
||||
|
||||
def test_diarisation_function(diariser_instance):
|
||||
"""_summary_
|
||||
|
||||
Args:
|
||||
diariser_instance (_type_): _description_
|
||||
"""
|
||||
with mock.patch.object(diariser_instance.model, 'apply', return_value='diarization_result'):
|
||||
diarization_output = diariser_instance.diarization('example_audio_file.wav')
|
||||
assert diarization_output == 'diarization_result'
|
||||
|
||||
@@ -9,6 +9,13 @@ from scraibe import Transcriber
|
||||
@patch("scraibe.Transcriber.load_model")
|
||||
|
||||
def test_transcriber(mock_load_model, audio_file, expected_transcription):
|
||||
"""_summary_
|
||||
|
||||
Args:
|
||||
mock_load_model (_type_): _description_
|
||||
audio_file (_type_): _description_
|
||||
expected_transcription (_type_): _description_
|
||||
"""
|
||||
mock_model = mock_load_model.return_value
|
||||
mock_model.transcribe.return_value ={"text": expected_transcription}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user