# AssertionError: assert <unittest.mock.MagicMock name='mock.method' id='140234567890'> is not None

- **ID:** `python/pytest-assertion-rewriting-error`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A test asserts that a mock object is not None, but the mock is returned instead of the actual value, indicating the mock was not configured correctly.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Configure the mock to return a specific value: `mock.method.return_value = 'real_value'`
   ```
2. **** (90% success)
   ```
   Use autospec=True in patch to ensure the mock matches the real method's signature.
   ```

## Dead Ends

- **** — This may still return a mock if the attribute is not properly set up, leading to confusing behavior. (70% fail)
- **** — A mock object is truthy, so this assertion always passes, masking the real issue. (90% fail)
