# 类型错误：test_case() 缺少 1 个必需的位置参数：'expected'

- **ID:** `python/typeerror-test-case-missing-args`
- **领域:** python
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

测试函数定义了必需参数但调用时未提供所有参数。

## 版本兼容性

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

## 解决方案

1. **Provide the missing argument in the test call** (95% 成功率)
   ```
   def test_case(input, expected): ... ; test_case(5, 10)
   ```
2. **Use pytest parametrize to supply arguments** (98% 成功率)
   ```
   @pytest.mark.parametrize('input,expected', [(5,10)]) 
def test_case(input, expected): ...
   ```

## 无效尝试

- **Adding a default value to expected** — Default values may mask missing arguments but still cause logic errors if not intended. (50% 失败率)
- **Ignoring the error and rerunning** — The test will continue to fail until the argument is provided. (90% 失败率)
