# AttributeError: <module 'module1' from '/path/module1.py'> does not have the attribute 'func'

- **ID:** `python/unittest-mock-patch-error`
- **Domain:** python
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

使用 unittest.mock.patch 时，目标属性不存在或路径错误

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.12 | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   @patch('module1.func', return_value=42)
   ```
2. **** (70% success)
   ```
   @patch('module1.func', create=True)
   ```

## Dead Ends

- **** — 属性可能确实存在但路径错误 (50% fail)
- **** — 如果目标错误，同样会失败 (40% fail)
