# AssertionError: expected call not found.
Expected: fetch('https://api.example.com')
  Actual: fetch()

- **ID:** `python/unittest-mock-magicmock-assertion`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

assert_called_with compares exact positional and keyword arguments. The actual call passed different arguments (e.g., a URL object instead of a string) or the mock was reset/reconfigured between the call and the assertion.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   mock_fetch.assert_called_once()
args, kwargs = mock_fetch.call_args
assert str(args[0]) == 'https://api.example.com'
   ```
2. **** (82% success)
   ```
   from unittest.mock import call, ANY
mock_fetch.assert_called_with(ANY)
assert mock_fetch.call_args.args[0].__str__().endswith('/api.example.com')
   ```

## Dead Ends

- **** — Only checks call count, not arguments; the bug (wrong URL) goes undetected. (80% fail)
- **** — matching.ANY makes the assertion always pass and hides the real argument mismatch. (85% fail)
