{
  "id": "python/unittest-mock-call-order",
  "signature": "AssertionError: Expected mock_calls to have been called in order. Actual calls: [call(1), call(2)]",
  "signature_zh": "断言错误：期望mock调用顺序为[call(1), call(2)]，实际为[call(2), call(1)]",
  "regex": "AssertionError:\\ Expected\\ mock_calls\\ to\\ have\\ been\\ called\\ in\\ order\\.\\ Actual\\ calls:\\ \\[call\\(1\\),\\ call\\(2\\)\\]",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "测试中检查了mock的调用顺序，但实际调用顺序与期望不符。",
  "root_cause_type": "generic",
  "root_cause_zh": "mock调用顺序与预期不一致，导致断言失败。",
  "versions": [
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "可能掩盖并发或逻辑错误。",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "不检查顺序，无法满足测试意图。",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "mock.assert_has_calls([call(1), call(2)], any_order=False)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "calls = []\ndef side_effect(x):\n    calls.append(x)\n    return x\nmock.side_effect = side_effect\nassert calls == [1, 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.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-01-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}