{
  "id": "python/pytest-doctest-output-mismatch",
  "signature": "Failed example:\n    print({'a': 1, 'b': 2})\nExpected:\n    {'a': 1, 'b': 2}\nGot:\n    {'b': 2, 'a': 1}",
  "signature_zh": "失败的示例：\n    print({'a': 1, 'b': 2})\n期望：\n    {'a': 1, 'b': 2}\n实际：\n    {'b': 2, 'a': 1}",
  "regex": "Failed\\ example:\\\n\\ \\ \\ \\ print\\(\\{'a':\\ 1,\\ 'b':\\ 2\\}\\)\\\nExpected:\\\n\\ \\ \\ \\ \\{'a':\\ 1,\\ 'b':\\ 2\\}\\\nGot:\\\n\\ \\ \\ \\ \\{'b':\\ 2,\\ 'a':\\ 1\\}",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Doctests compare exact string output. Dict ordering in Python 3.7+ is insertion order, so the expected output must match the actual insertion order, or use sorted output.",
  "root_cause_type": "generic",
  "root_cause_zh": "Doctest 比较精确的字符串输出。Python 3.7+ 中字典按插入顺序排列，因此期望输出必须与实际插入顺序一致，或使用排序输出。",
  "versions": [
    {
      "version": "3.8",
      "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.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Skips the test entirely, losing coverage for the function's behavior.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Hash seed affects set ordering, not dict insertion order in modern Python; dicts preserve insertion order regardless.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": ">>> print(dict(sorted({'b': 2, 'a': 1}.items())))\n{'a': 1, 'b': 2}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": ">>> print({'a': 1, 'b': 2})  # doctest: +ELLIPSIS\n{...}",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}