# AssertionError: assert False + True == True (pytest assertion rewriting failed)

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

## Root Cause

Pytest's assertion rewriting mechanism fails to properly rewrite the assertion due to complex expressions or use of 'is' operator with non-boolean values.

## Version Compatibility

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

## Workarounds

1. **Simplify the assertion into multiple steps for better rewriting.** (90% success)
   ```
   result = False + True; assert result == True
   ```
2. **Use explicit comparison with '==' instead of 'is' for value equality.** (85% success)
   ```
   assert (False + True) == True  # instead of 'is True'
   ```

## Dead Ends

- **Adding more assertions to debug the expression** — The rewriting issue persists for similar complex expressions. (70% fail)
- **Disabling assertion rewriting globally with -O flag** — This removes all assertion checks, which is not desirable for testing. (60% fail)
