Files
wehub-resource-sync 7a0da7932b
Backwards Compatibility / Verify Encryption Constants (push) Waiting to run
Backwards Compatibility / PyPI Version Compatibility (push) Waiting to run
Backwards Compatibility / Database Migration Tests (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-form] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-metrics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-workflow] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [history-news] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [library] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [link-analytics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [mobile] (push) Blocked by required conditions
Docker Tests (Consolidated) / detect-changes (push) Waiting to run
Docker Tests (Consolidated) / Build Test Image (push) Waiting to run
Docker Tests (Consolidated) / All Pytest Tests + Coverage (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [accessibility] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [api-crud] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-login] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-register] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-lifecycle] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [error-benchmark] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) (push) Blocked by required conditions
Docker Tests (Consolidated) / Accessibility Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Unit Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Example Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / Production Image Smoke Test (push) Blocked by required conditions
Docker Tests (Consolidated) / Infrastructure Tests (push) Blocked by required conditions
OSSF Scorecard / OSSF Security Scorecard Analysis (push) Waiting to run
OSV-Scanner (Scheduled) / scan-scheduled (push) Failing after 0s
Create Release / test-gate (push) Has been cancelled
Create Release / release-gate (push) Has been cancelled
Create Release / ci-gate (push) Has been cancelled
Create Release / version-check (push) Has been cancelled
Create Release / e2e-test-gate (push) Has been cancelled
Create Release / responsive-test-gate (push) Has been cancelled
Create Release / compat-test-gate (push) Has been cancelled
Create Release / compose-integration-gate (push) Has been cancelled
Create Release / vulture-gate (push) Has been cancelled
Create Release / build (push) Has been cancelled
Create Release / provenance (push) Has been cancelled
Create Release / prerelease-docker (push) Has been cancelled
Create Release / publish-docker (push) Has been cancelled
Create Release / create-release (push) Has been cancelled
Create Release / cleanup-changelog (push) Has been cancelled
Create Release / trigger-pypi (push) Has been cancelled
Create Release / monitor-pypi (push) Has been cancelled
Create Release / Clean up orphan prerelease tags and signatures (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:08:55 +08:00

125 lines
3.7 KiB
Python

"""Extended tests for text_cleaner.remove_surrogates.
Adds edge cases for surrogate pair handling, emoji preservation, and
encoding scenarios not covered by the existing test_text_cleaner.py.
"""
from local_deep_research.text_processing.text_cleaner import remove_surrogates
class TestRemoveSurrogatesEmojiAndSymbols:
"""Emoji and special symbol preservation."""
def test_common_emoji_preserved(self):
text = "Hello 🌍 World 🚀"
assert remove_surrogates(text) == text
def test_math_symbols_preserved(self):
text = "∑ ∫ ∏ √ ∞ ≈"
assert remove_surrogates(text) == text
def test_currency_symbols_preserved(self):
text = "Price: €100 ¥200 £50"
assert remove_surrogates(text) == text
def test_box_drawing_preserved(self):
text = "┌──┐\n│ │\n└──┘"
assert remove_surrogates(text) == text
class TestRemoveSurrogatesMixedScripts:
"""Mixed script handling."""
def test_cjk_characters_preserved(self):
text = "日本語テスト Chinese中文 Korean한국어"
assert remove_surrogates(text) == text
def test_arabic_preserved(self):
text = "مرحبا بالعالم"
assert remove_surrogates(text) == text
def test_cyrillic_preserved(self):
text = "Привет мир"
assert remove_surrogates(text) == text
def test_devanagari_preserved(self):
text = "नमस्ते दुनिया"
assert remove_surrogates(text) == text
class TestRemoveSurrogatesSurrogatePairs:
"""Surrogate pair specific tests."""
def test_lone_high_surrogate_handled(self):
text = "before\ud800after"
result = remove_surrogates(text)
assert "before" in result
assert "after" in result
result.encode("utf-8") # Must not raise
def test_lone_low_surrogate_handled(self):
text = "text\udfffend"
result = remove_surrogates(text)
assert "text" in result
assert "end" in result
result.encode("utf-8")
def test_consecutive_high_surrogates(self):
text = "\ud800\ud801\ud802"
result = remove_surrogates(text)
result.encode("utf-8")
def test_surrogate_at_start(self):
text = "\ud800hello"
result = remove_surrogates(text)
assert "hello" in result
result.encode("utf-8")
def test_surrogate_at_end(self):
text = "hello\ud800"
result = remove_surrogates(text)
assert "hello" in result
result.encode("utf-8")
def test_only_surrogates(self):
text = "\ud800\udc00\ud801"
result = remove_surrogates(text)
result.encode("utf-8") # Must not raise
class TestRemoveSurrogatesLargeInput:
"""Performance and large input tests."""
def test_large_clean_text(self):
text = "x" * 100000
result = remove_surrogates(text)
assert len(result) == 100000
def test_large_text_with_scattered_surrogates(self):
parts = []
for i in range(100):
parts.append("normal text " * 10)
parts.append("\ud800")
text = "".join(parts)
result = remove_surrogates(text)
result.encode("utf-8")
assert "normal text" in result
class TestRemoveSurrogatesSpecialCases:
"""Special and boundary cases."""
def test_null_byte_handled(self):
text = "before\x00after"
result = remove_surrogates(text)
assert "before" in result
assert "after" in result
def test_replacement_char_preserved(self):
text = "test\ufffdtext"
assert remove_surrogates(text) == text
def test_bom_preserved(self):
text = "\ufeffHello"
assert remove_surrogates(text) == text