# test_something (tests.test_x.TestX.test_something) ... ok
# 但测试体包含 assertEqual(1, 2) 却从未执行

- **ID:** `python/unittest-assertion-always-true-no-self`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

TestCase 中名为 test_* 的辅助方法缺少 `self` 参数或被定义为 staticmethod，unittest 将其当作测试但静默失败或被跳过。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   class TestX(unittest.TestCase):
    def _build_payload(self):
        return {'k': 1}

    def test_payload(self):
        self.assertEqual(self._build_payload(), {'k': 1})
   ```
2. **** (90% 成功率)
   ```
   def build_payload():
    return {'k': 1}

class TestX(unittest.TestCase):
    def test_payload(self):
        self.assertEqual(build_payload(), {'k': 1})
   ```

## 无效尝试

- **** — Renaming fixes discovery but does not explain why the assertions were silently skipped; other tests may still be misnamed. (40% 失败率)
- **** — Hides the real issue; the method is still collected as a test and reported as skipped, polluting results. (70% 失败率)
