Files
speaking-practice/tests/encoding_repair_test.py
T
2026-06-03 00:34:42 +08:00

20 lines
544 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from backend.db import repair_mojibake_text
def test_repairs_chinese_mojibake():
assert repair_mojibake_text("未分类") == "未分类"
def test_repairs_english_punctuation_mojibake():
assert repair_mojibake_text("employees’ lives") == "employees’ lives"
def test_keeps_normal_text_unchanged():
assert repair_mojibake_text("未分类") == "未分类"
assert repair_mojibake_text("English") == "English"