MCPcopy Create free account
hub / github.com/OpenMOSS/MOSS-TTS-Nano / run_tests

Function run_tests

tts_robust_normalizer_single_script.py:378–403  ·  view source on GitHub ↗
(verbose: bool = True)

Source from the content-addressed store, hash-verified

376
377
378def run_tests(verbose: bool = True) -> None:
379 failed = []
380
381 for name, text, expected in TEST_CASES:
382 actual = normalize_tts_text(text)
383 if actual != expected:
384 failed.append((name, text, expected, actual))
385 continue
386
387 # 幂等性:第二次归一化不应继续改动结果
388 second = normalize_tts_text(actual)
389 if second != actual:
390 failed.append((name + "_idempotence", actual, actual, second))
391
392 if failed:
393 lines = ["\nTEST FAILED:\n"]
394 for name, text, expected, actual in failed:
395 lines.append(f"[{name}]")
396 lines.append(f"input : {text}")
397 lines.append(f"expected: {expected}")
398 lines.append(f"actual : {actual}")
399 lines.append("")
400 raise AssertionError("\n".join(lines))
401
402 if verbose:
403 print(f"All {len(TEST_CASES)} tests passed.")
404
405
406if __name__ == "__main__":

Calls 1

normalize_tts_textFunction · 0.85

Tested by

no test coverage detected