{
  "id": "python/pytest-doctest-optionflags-mismatch",
  "signature": "Failed example:\n    print({'a': 1, 'b': 2})\nExpected:\n    {'a': 1, 'b': 2}\nGot:\n    {'a': 1, 'b': 2}\n\n1 items had failures",
  "signature_zh": "失败示例:\n    print({'a': 1, 'b': 2})\n期望:\n    {'a': 1, 'b': 2}\n实际:\n    {'a': 1, 'b': 2}\n\n1 项存在失败",
  "regex": "Failed\\ example:\\\n\\ \\ \\ \\ print\\(\\{'a':\\ 1,\\ 'b':\\ 2\\}\\)\\\nExpected:\\\n\\ \\ \\ \\ \\{'a':\\ 1,\\ 'b':\\ 2\\}\\\nGot:\\\n\\ \\ \\ \\ \\{'a':\\ 1,\\ 'b':\\ 2\\}\\\n\\\n1\\ items\\ had\\ failures",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "Dict ordering differs across Python versions or the output has trailing whitespace/ordering that differs. Without NORMALIZE_WHITESPACE or ELLIPSIS, doctest requires byte-exact output.",
  "root_cause_type": "generic",
  "root_cause_zh": "字典顺序在不同 Python 版本间不同，或输出存在尾随空白/顺序差异。未启用 NORMALIZE_WHITESPACE 或 ELLIPSIS 时，doctest 要求输出逐字节一致。",
  "versions": [
    {
      "version": "7.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Breaks on other Python versions where dict ordering or repr differ.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Loses documentation test coverage; hides real regressions.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Enable normalization in pytest.ini:\n  [tool.pytest.ini_options]\n  doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS\nOr in docstring:\n  >>> print(d)  # doctest: +NORMALIZE_WHITESPACE",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.92,
      "how": "Sort dict output explicitly in the docstring example:\n  >>> sorted(d.items())\n  [('a', 1), ('b', 2)]",
      "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.84,
  "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": []
}