|
| 1 | +import pytest |
| 2 | + |
| 3 | +from sqlmesh.utils import sanitize_name |
| 4 | + |
| 5 | + |
| 6 | +@pytest.mark.parametrize( |
| 7 | + "raw,exclude_unicode,include_unicode", |
| 8 | + [ |
| 9 | + ("simple", "simple", "simple"), |
| 10 | + ("snake_case", "snake_case", "snake_case"), |
| 11 | + ("客户数据", "____", "客户数据"), |
| 12 | + ("客户-数据 v2", "______v2", "客户_数据_v2"), |
| 13 | + ("中文,逗号", "_____", "中文_逗号"), |
| 14 | + ("a/b", "a_b", "a_b"), |
| 15 | + ("spaces\tand\nnewlines", "spaces_and_newlines", "spaces_and_newlines"), |
| 16 | + ("data📦2025", "data_2025", "data_2025"), |
| 17 | + ("MiXeD123_名字", "MiXeD123___", "MiXeD123_名字"), |
| 18 | + ("", "", ""), |
| 19 | + ], |
| 20 | +) |
| 21 | +def test_sanitize_name_no_(raw, exclude_unicode, include_unicode): |
| 22 | + assert sanitize_name(raw) == exclude_unicode |
| 23 | + assert sanitize_name(raw, include_unicode=True) == include_unicode |
0 commit comments