{
  "id": "python/pytest-assert-regex-mismatch",
  "signature": "AssertionError: Regex pattern '\\d+' does not match 'abc'.\nassert regex_search('\\d+', 'abc')",
  "signature_zh": "AssertionError: 正则表达式模式 '\\d+' 不匹配 'abc'。\nassert regex_search('\\d+', 'abc')",
  "regex": "AssertionError:\\ Regex\\ pattern\\ '\\\\d\\+'\\ does\\ not\\ match\\ 'abc'\\.\\\nassert\\ regex_search\\('\\\\d\\+',\\ 'abc'\\)",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A test using pytest's `re.match` or `assert re.search` fails because the string does not contain the expected pattern, often due to incorrect regex or wrong input.",
  "root_cause_type": "generic",
  "root_cause_zh": "使用 pytest 的 `re.match` 或 `assert re.search` 的测试失败，因为字符串不包含预期的模式，通常是由于正则表达式错误或输入错误。",
  "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"
    },
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.11",
      "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": "This may not capture the exact pattern requirements and can lead to false passes.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This makes the test useless as it matches anything, defeating the purpose of validation.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Test the regex separately: `import re; assert re.search(r'\\d+', 'abc123')` to verify the pattern works.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Use raw strings for regex patterns to avoid escape issues: `r'\\d+'`",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-03-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}