{
  "id": "python/unittest-skipif-condition-error",
  "signature": "TypeError: skipIf() argument 1 must be bool, not str",
  "signature_zh": "类型错误：skipIf() 参数 1 必须是布尔值，而不是字符串",
  "regex": "TypeError:\\ skipIf\\(\\)\\ argument\\ 1\\ must\\ be\\ bool,\\ not\\ str",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "The @unittest.skipIf decorator received a string condition instead of a boolean expression, often due to missing call or wrong syntax.",
  "root_cause_type": "generic",
  "root_cause_zh": "@unittest.skipIf 装饰器接收了字符串条件而非布尔表达式，通常是由于缺少调用或语法错误。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Using skipIf with a string literal like 'True'",
      "why_fails": "String 'True' is not a boolean; it will always evaluate to True (truthy) but cause TypeError.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Wrapping the condition in quotes to avoid syntax errors",
      "why_fails": "Quotes make it a string, which is not accepted by skipIf.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure the condition is a boolean expression, not a string.",
      "success_rate": 0.9,
      "how": "@unittest.skipIf(sys.version_info < (3, 9), 'Requires Python 3.9+')",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use skipUnless for inverse logic if condition is complex.",
      "success_rate": 0.85,
      "how": "@unittest.skipUnless(hasattr(module, 'function'), 'Module missing function')",
      "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.87,
  "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": []
}