{
  "id": "python/unittest-setup-error",
  "signature": "TypeError: setUp() takes 1 positional argument but 2 were given",
  "signature_zh": "类型错误：setUp() 只接受 1 个位置参数，但传入了 2 个",
  "regex": "TypeError:\\ setUp\\(\\)\\ takes\\ 1\\ positional\\ argument\\ but\\ 2\\ were\\ given",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "在 TestCase 类中定义了带参数的 setUp 方法，但 unittest 调用时不传参数",
  "root_cause_type": "generic",
  "root_cause_zh": "在 TestCase 类中定义了带参数的 setUp 方法，但 unittest 调用时不传参数",
  "versions": [
    {
      "version": "3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "unittest 仍会只传 self",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "如果方法名不是 setUp，则不会被调用",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "def setUp(self):",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.7,
      "how": "@classmethod\ndef setUpClass(cls):",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}