Files
shanxia2.0/backend/tests/test_ethnic.py
T
2026-05-17 08:36:37 +08:00

18 lines
554 B
Python

"""民族码表 CRUD 冒烟测试"""
from app.core.database import SessionLocal
from app.crud.ethnic import list_ethnics
def test_list_ethnics_has_han():
db = SessionLocal()
try:
rows = list_ethnics(db)
assert len(rows) >= 56
han = next((r for r in rows if r["ethnicName"] == "汉族"), None)
assert han is not None
assert han["ethnicCode"] == "01"
filtered = list_ethnics(db, keyword="蒙古")
assert any(r["ethnicName"] == "蒙古族" for r in filtered)
finally:
db.close()