Files
DeepTutor/tests/knowledge/test_naming.py
Bingxi Zhao (Frank) 7fce54d98a chore: prepare v1.3.0 release
Made-with: Cursor
2026-04-27 21:09:25 +08:00

16 lines
576 B
Python

from __future__ import annotations
import pytest
from deeptutor.knowledge.naming import validate_knowledge_base_name
def test_validate_knowledge_base_name_allows_unicode_and_spaces() -> None:
assert validate_knowledge_base_name(" 高等数学 KB ") == "高等数学 KB"
@pytest.mark.parametrize("name", ["bad/name", "bad\\name", "bad?name", "bad#name", "bad%name"])
def test_validate_knowledge_base_name_rejects_path_and_url_separators(name: str) -> None:
with pytest.raises(ValueError, match="reserved characters"):
validate_knowledge_base_name(name)