{
  "id": "python/pytest-fixture-params-ids-type",
  "signature": "TypeError: ids must be a list or callable, got <class 'str'>",
  "signature_zh": "类型错误：ids 必须是列表或可调用对象，得到字符串",
  "regex": "TypeError:\\ ids\\ must\\ be\\ a\\ list\\ or\\ callable,\\ got\\ <class\\ 'str'>",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "在 parametrize 中传递 ids 参数时使用了字符串而不是列表或函数。",
  "root_cause_type": "generic",
  "root_cause_zh": "在 parametrize 中传递 ids 参数时使用了字符串而不是列表或函数。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "ids='a,b'",
      "why_fails": "尝试将字符串转换为列表但忘记括号",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    },
    {
      "action": "ids=lambda x: 'id'",
      "why_fails": "尝试使用 lambda 但 lambda 返回字符串而非列表",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "使用列表",
      "success_rate": 0.98,
      "how": "@pytest.mark.parametrize('x', [1,2], ids=['a','b'])",
      "condition": "",
      "sources": []
    },
    {
      "action": "使用可调用对象",
      "success_rate": 0.95,
      "how": "@pytest.mark.parametrize('x', [1,2], ids=lambda x: f'id_{x}')",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-07-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}