# unittest.case._UnexpectedSuccess: test_something

- **ID:** `python/unittest-expected-failure-unexpected-success`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

标记为 `@unittest.expectedFailure` 的测试通过了，意味着已知 bug 已修复或测试不再按预期失败。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Remove `@unittest.expectedFailure` and run the test; it should pass.
   ```
2. **** (90% 成功率)
   ```
   @unittest.skipIf(sys.version_info < (3, 10), 'requires 3.10')
def test_something(): ...
   ```

## 无效尝试

- **** — If the bug reappears, the test will fail and may be ignored. (50% 失败率)
- **** — Hides the fact that the bug is fixed; the test never runs. (70% 失败率)
