{
  "id": "python/pytest-assertion-rewrite-error",
  "signature": "AssertionError: assert <Mock id='140123456789'> == 5",
  "signature_zh": "断言错误：assert <Mock id='140123456789'> == 5",
  "regex": "AssertionError:\\ assert\\ <Mock\\ id='140123456789'>\\ ==\\ 5",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "在断言中使用了 mock 对象而非实际返回值，导致比较失败。",
  "root_cause_type": "generic",
  "root_cause_zh": "在断言中使用了 mock 对象而非实际返回值，导致比较失败。",
  "versions": [
    {
      "version": "7.4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "mock 对象始终不等于任何值，除非配置了 return_value。",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "如果调用参数不匹配，仍会失败，且不能验证返回值。",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 1.0,
      "how": "`mock_obj.return_value = 5` 然后断言 `mock_obj() == 5`。",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "`mock_obj.assert_called_once_with(参数)` 验证调用参数。",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}