# AttributeError: Mock object has no attribute 'some_method'

- **ID:** `python/unittest-mock-autospec-missing-attribute`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Using `create_autospec` restricts the mock to the real object's attributes; if `some_method` is dynamically added or misspelled, access fails.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   class MyClass:
    def some_method(self): ...

mock = create_autospec(MyClass)
mock.some_method()
   ```
2. **** (80% success)
   ```
   mock = Mock(spec_set=['some_method', 'other_method'])
   ```

## Dead Ends

- **** — Loses the safety of autospec and may hide typos in method names. (60% fail)
- **** — Defeats the purpose of autospec and may not match the real signature. (70% fail)
