{
  "id": "python/pytest-failed-assertion-with-fixture",
  "signature": "AssertionError: Expected 200 but got 404\nassert 404 == 200",
  "signature_zh": "AssertionError: 期望 200 但得到 404\nassert 404 == 200",
  "regex": "AssertionError:\\ Expected\\ 200\\ but\\ got\\ 404\\\nassert\\ 404\\ ==\\ 200",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A test function using a fixture that sets up an HTTP request expects a 200 status code, but the endpoint returns 404 due to incorrect URL or missing resource.",
  "root_cause_type": "generic",
  "root_cause_zh": "使用 fixture 设置 HTTP 请求的测试函数期望返回 200 状态码，但由于 URL 错误或资源缺失，端点返回了 404。",
  "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"
    },
    {
      "version": "3.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This masks the actual problem; the test still fails to validate the correct behavior, leading to false positives in other scenarios.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The issue is not timing-related; the server is running but the endpoint is wrong or missing, so sleeping does not help.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Update the fixture to use the correct URL: `@pytest.fixture\ndef api_client():\n    return Client('http://localhost:8000/api/v2')`",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Verify the endpoint exists by testing manually with curl before running the test suite.",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}