{
  "id": "python/pytest-capture-using-fixture-as-function",
  "signature": "TypeError: 'function' object is not callable",
  "signature_zh": "类型错误：'function'对象不可调用",
  "regex": "TypeError:\\ 'function'\\ object\\ is\\ not\\ callable",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "在pytest测试中，将fixture名称错误地用作函数调用，而实际上fixture是一个可调用对象，但可能被覆盖或误用。",
  "root_cause_type": "generic",
  "root_cause_zh": "pytest测试中，fixture名称被错误地当作函数调用，导致TypeError。",
  "versions": [
    {
      "version": "3.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "删除fixture会导致其他测试无法使用，且根本原因未解决。",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "lambda不会改变fixture的本质，调用仍会失败。",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "def test_example(my_fixture):\n    assert my_fixture == expected",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "确保没有定义与fixture同名的函数，例如：def my_fixture(): pass 会覆盖fixture",
      "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.81,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}