"""Tests datu papildināšanas helperiem.""" from __future__ import annotations import random from maris_core.data.augment import back_translate, random_synonym_swap def test_random_synonym_swap_replaces_known_words_without_losing_punctuation() -> None: random.seed(7) augmented = random_synonym_swap("Fast image, good code!", rate=1.0) assert augmented != "Fast image, good code!" assert augmented.endswith("!") assert "," in augmented def test_random_synonym_swap_returns_original_for_unknown_words() -> None: assert random_synonym_swap("xyz qwerty", rate=1.0) == "xyz qwerty" def test_back_translate_uses_language_specific_replacements() -> None: assert back_translate("Fast help creates a good plan.", lang="en") != ( "Fast help creates a good plan." ) def test_back_translate_falls_back_to_synonym_swap_for_unknown_language() -> None: random.seed(3) augmented = back_translate("Fast image", lang="de") assert augmented != "Fast image"