Пример #1
0
def test_get_files_exist():
    path = Path("tests/nemo_config_samples")
    manifest_files = get_files(path, ".yaml")

    assert len(manifest_files) == 3
    assert isinstance(manifest_files[0], Path)
    assert manifest_files[0].exists()
Пример #2
0
def test_get_files_work_with_string_input():
    path = "tests/nemo_config_samples"
    manifest_files = get_files(path, ".yaml")

    assert len(manifest_files) == 3
    assert isinstance(manifest_files[0], Path)
    assert manifest_files[0].exists()
Пример #3
0
def sample_manifest(sample_data):
    audio_files = get_files(sample_data / "LapsBM-F004", ".wav")

    manifest = sample_data / "test_example_manifest.json"
    with open(manifest, "w", encoding="utf8") as f:
        for fil in audio_files:
            data = {
                "audio_filepath":
                str(fil.resolve()),
                "duration":
                audio_len(fil),
                "text":
                normalize_text(fil.with_suffix(".txt").read_text().strip()),
            }
            json.dump(data, f)
            f.write("\n")
    return manifest
Пример #4
0
def test_get_files_dont_exist():
    path = Path("tests/nemo_config_samples")
    manifest_files = get_files(path, ".mp3")

    assert len(manifest_files) == 0
Пример #5
0
def test_audio_len(sample_data):
    audio_files = get_files(sample_data, ".wav")
    audio_length = audio_len(audio_files[0])
    assert audio_length > 0.0
    assert isinstance(audio_length, float)