{
  "id": "python/pytest-assertion-rewriting-error",
  "signature": "AssertionError: assert <unittest.mock.MagicMock name='mock.method' id='140234567890'> is not None",
  "signature_zh": "AssertionError: assert <unittest.mock.MagicMock name='mock.method' id='140234567890'> is not None",
  "regex": "AssertionError:\\ assert\\ <unittest\\.mock\\.MagicMock\\ name='mock\\.method'\\ id='140234567890'>\\ is\\ not\\ None",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A test asserts that a mock object is not None, but the mock is returned instead of the actual value, indicating the mock was not configured correctly.",
  "root_cause_type": "generic",
  "root_cause_zh": "测试断言模拟对象不是 None，但返回了模拟对象而不是实际值，表明模拟对象配置不正确。",
  "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 may still return a mock if the attribute is not properly set up, leading to confusing behavior.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "A mock object is truthy, so this assertion always passes, masking the real issue.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Configure the mock to return a specific value: `mock.method.return_value = 'real_value'`",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use autospec=True in patch to ensure the mock matches the real method's signature.",
      "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": "2025-08-25",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}