From 17c7cf5f9bdee0ef8d2bb639dfb9bd42eade5a93 Mon Sep 17 00:00:00 2001 From: iibaranov-IG Date: Thu, 30 Jul 2026 02:17:01 -0700 Subject: [PATCH] test(text): cover Russian XSAMPA normalization --- tests/test_russian_phonemes.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/test_russian_phonemes.py diff --git a/tests/test_russian_phonemes.py b/tests/test_russian_phonemes.py new file mode 100644 index 00000000..86a6287d --- /dev/null +++ b/tests/test_russian_phonemes.py @@ -0,0 +1,28 @@ +import pytest + +from GPT_SoVITS.text.russian import normalize_xsampa_symbol + + +@pytest.mark.parametrize( + ("symbol", "expected"), + [ + ("d'", "D"), + ("n'", "N"), + ("r'", "R"), + ("l'", "L"), + ("a:", "A"), + ("1", "I"), + ("@", "A"), + ("6", "A"), + ("s`", "S"), + ("S`", "S"), + ], +) +def test_normalize_russian_xsampa_symbol(symbol, expected): + assert normalize_xsampa_symbol(symbol) == expected + + +@pytest.mark.parametrize("symbol", ["", "?", "t_s", None]) +def test_normalize_russian_xsampa_symbol_rejects_unsupported_input(symbol): + with pytest.raises(ValueError, match="Russian XSAMPA|Unsupported Russian"): + normalize_xsampa_symbol(symbol)