{
  "id": "python/pytest-assertion-rewriting-failure",
  "signature": "AssertionError: assert False + True == True (pytest assertion rewriting failed)",
  "signature_zh": "断言错误：assert False + True == True（pytest 断言重写失败）",
  "regex": "AssertionError:\\ assert\\ False\\ \\+\\ True\\ ==\\ True\\ \\(pytest\\ assertion\\ rewriting\\ failed\\)",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Pytest's assertion rewriting mechanism fails to properly rewrite the assertion due to complex expressions or use of 'is' operator with non-boolean values.",
  "root_cause_type": "generic",
  "root_cause_zh": "由于复杂表达式或对非布尔值使用 'is' 运算符，pytest 的断言重写机制未能正确重写断言。",
  "versions": [
    {
      "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"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding more assertions to debug the expression",
      "why_fails": "The rewriting issue persists for similar complex expressions.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Disabling assertion rewriting globally with -O flag",
      "why_fails": "This removes all assertion checks, which is not desirable for testing.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Simplify the assertion into multiple steps for better rewriting.",
      "success_rate": 0.9,
      "how": "result = False + True; assert result == True",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use explicit comparison with '==' instead of 'is' for value equality.",
      "success_rate": 0.85,
      "how": "assert (False + True) == True  # instead of 'is True'",
      "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.8,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-10-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}