{
  "id": "python/assertionerror-assert-raises",
  "signature": "AssertionError: Exception not raised",
  "signature_zh": "断言错误：未引发异常",
  "regex": "AssertionError:\\ Exception\\ not\\ raised",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A test expects an exception to be raised using pytest.raises or assertRaises, but the code executes without exception.",
  "root_cause_type": "generic",
  "root_cause_zh": "测试期望使用 pytest.raises 或 assertRaises 引发异常，但代码执行时未引发异常。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding a try-except block manually",
      "why_fails": "Manual try-except may miss the exact exception type or not fail properly.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using a broader exception type",
      "why_fails": "Catches unintended exceptions and may hide bugs.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use pytest.raises with exact exception",
      "success_rate": 0.95,
      "how": "with pytest.raises(ValueError):\n    raise ValueError('test')",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use unittest.TestCase.assertRaises",
      "success_rate": 0.9,
      "how": "self.assertRaises(ValueError, func, arg)",
      "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-12-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}