# AssertionError: assert 4 == 5
 +  where 4 = <function calculate_sum.<locals>.<lambda> at 0x7f8b1c3d4a9>

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

## Root Cause

pytest 在捕获断言时，错误地显示了 lambda 函数的内部表示，导致调试信息混乱，实际是逻辑错误

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.4.0 | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   检查函数实际返回值，修正断言条件。例如：assert calculate_sum(2,2) == 4
   ```
2. **** (70% success)
   ```
   对于浮点数比较，使用 assert result == pytest.approx(5.0)
   ```

## Dead Ends

- **** — 根本问题不在 lambda，而是断言逻辑本身错误，修改函数形式不能修复 (30% fail)
- **** — 只是隐藏了错误信息，没有解决断言失败的本质 (80% fail)
