# AssertionError: assert <myapp.models.User object at 0x7f8b1c0d5e50> == <myapp.models.User object at 0x7f8b1c0d5e50>
E   AttributeError: 'User' object has no attribute '__eq__'

- **ID:** `python/pytest-assertion-rewrite-cache-stale`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The assertion compares two objects without __eq__ defined, so identity comparison fails. The confusing part is that pytest's assertion rewrite shows the repr, making it look like they should be equal.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   class User:
    def __init__(self, id):
        self.id = id
    def __eq__(self, other):
        return isinstance(other, User) and self.id == other.id
   ```
2. **** (90% success)
   ```
   assert result.id == expected.id
assert result.name == expected.name
   ```

## Dead Ends

- **** — id() comparison only checks identity; if the test intends value equality, this is a false pass. (70% fail)
- **** — Same identity semantics; does not fix the missing __eq__ for value comparison. (80% fail)
