import pandas as pd

from fmatch.core.engine import vectorized_safe_str


def test_vectorized_safe_str_handles_arrow_strings_with_literal_unicode_escapes():
    series = pd.Series(
        ["Acme \\u2019 Test", "\u682a\u5f0f\u4f1a\u793eAcme", None, "null"],
        dtype="string[pyarrow]",
    )

    result = vectorized_safe_str(series)

    assert result.tolist() == ["acme \\u2019 test", "\u682a\u5f0f\u4f1a\u793eacme", "", ""]
