| 1234567891011121314151617 |
- """民族码表 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()
|