{
  "id": "python/pytest-raises-no-exception",
  "signature": "Failed: DID NOT RAISE <class 'ValueError'>",
  "signature_zh": "失败：未引发 <class 'ValueError'>",
  "regex": "Failed:\\ DID\\ NOT\\ RAISE\\ <class\\ 'ValueError'>",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "The code block inside pytest.raises() did not raise the expected exception, indicating a bug or incorrect test assumption.",
  "root_cause_type": "generic",
  "root_cause_zh": "pytest.raises() 内部的代码块未引发预期的异常，表明存在错误或不正确的测试假设。",
  "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 inside pytest.raises to catch the exception",
      "why_fails": "pytest.raises already handles exception catching; extra try-except may swallow the exception.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Changing the expected exception to a broader type",
      "why_fails": "This may mask the real issue where no exception is raised at all.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Review the code to ensure it raises the expected exception under the given conditions.",
      "success_rate": 0.9,
      "how": "Add print statements or debug to verify the code path.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use pytest.raises with match parameter to check exception message.",
      "success_rate": 0.85,
      "how": "with pytest.raises(ValueError, match='invalid value'): code_that_should_raise()",
      "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": []
}