# AttributeError: <module 'unittest' from '.../unittest/__init__.py'> has no attribute 'mock'

- **ID:** `python/unittest-mock-not-callable-import`
- **Domain:** python
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The test uses `import unittest` and then `unittest.mock.patch`, but `unittest.mock` is not automatically imported as an attribute. It must be imported explicitly.

## Version Compatibility

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

## Workarounds

1. **** (97% success)
   ```
   Import mock explicitly:

import unittest
from unittest import mock

class TestX(unittest.TestCase):
    @mock.patch('mymodule.func')
    def test_it(self, m):
        ...
   ```
2. **** (97% success)
   ```
   Or import the submodule directly:

from unittest.mock import patch, MagicMock
   ```

## Dead Ends

- **** — unittest is part of the standard library; installing a PyPI package named 'unittest' either fails or installs an unrelated shim that shadows the stdlib. (95% fail)
- **** — Modifying the stdlib is fragile and the change is overwritten on interpreter upgrade. (90% fail)
