# AttributeError: module 'unittest' has no attribute 'mock'

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

## Root Cause

In Python 3.2 and earlier, mock is not part of unittest; must import mock separately or use unittest.mock in Python 3.3+.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.2 | active | — | — |
| 3.3 | active | — | — |
| 3.4 | active | — | — |

## Workarounds

1. **Import mock from unittest for Python 3.3+** (95% success)
   ```
   from unittest.mock import Mock, patch
   ```
2. **Use backport mock for older Python** (90% success)
   ```
   pip install mock; then from mock import Mock, patch
   ```

## Dead Ends

- **Installing mock via pip** — mock is available as a backport but not integrated into unittest; import path is different. (60% fail)
- **Using unittest.mock without importing** — If Python version is < 3.3, unittest.mock does not exist. (80% fail)
