{
  "id": "python/pytest-capture-stdout-assertion",
  "signature": "AssertionError: assert 'Hello' in '' (captured stdout is empty)",
  "signature_zh": "断言错误：assert 'Hello' in ''（捕获的 stdout 为空）",
  "regex": "AssertionError:\\ assert\\ 'Hello'\\ in\\ ''\\ \\(captured\\ stdout\\ is\\ empty\\)",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "测试期望捕获标准输出，但被测代码未打印任何内容，或输出被重定向。",
  "root_cause_type": "generic",
  "root_cause_zh": "测试期望捕获标准输出，但被测代码未打印任何内容，或输出被重定向。",
  "versions": [
    {
      "version": "7.4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "修改被测代码，且可能不满足测试意图。",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "如果代码本身没有输出，flush 无效。",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "确保代码中有 print 或 logging 输出，且使用 capsys 捕获。",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "在测试中调用 `out, err = capsys.readouterr()` 获取输出并断言。",
      "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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-03-08",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}