# TypeError: 'NoneType' object is not callable when using mock.assert_called_with

- **ID:** `python/unittest-mock-assert-called-with-typeerror`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The mock object is not properly configured or is being replaced by a non-callable value (e.g., None) before the assertion is made.

## Version Compatibility

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

## Workarounds

1. **Ensure the mock is created with 'autospec=True' to maintain callable signature.** (85% success)
   ```
   mock = unittest.mock.MagicMock(autospec=True); mock.assert_called_with(args)
   ```
2. **Verify the mock is not overwritten by using patch with return_value set explicitly.** (80% success)
   ```
   with unittest.mock.patch('module.function', return_value=mock_callable): ...
   ```

## Dead Ends

- **Adding more mock assertions without checking mock creation** — The core issue is the mock object itself; additional assertions will fail similarly. (90% fail)
- **Using patch decorator incorrectly and assuming mock is automatically callable** — If patch replaces the object with a non-callable, the mock will not be callable. (75% fail)
