# 在 test_math.py 中：@pytest.mark.parametrize 参数名 ['a', 'b'] 与测试函数签名 ['x', 'y'] 不匹配

- **ID:** `python/pytest-parametrize-marks-mismatch`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

parametrize 的 argnames 字符串与测试函数的参数名不匹配。pytest 要求名称完全一致（对元组参数而言顺序也重要）。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 7.x | active | — | — |
| 8.x | active | — | — |

## 解决方案

1. **** (98% 成功率)
   ```
   Match names exactly:
  @pytest.mark.parametrize('x,y', [(1,2),(3,4)])
  def test_add(x, y): ...
Or use a list of names:
  @pytest.mark.parametrize(['x','y'], [...])
   ```
2. **** (95% 成功率)
   ```
   Use pytest.param with ids for clarity:
  @pytest.mark.parametrize('x,y', [pytest.param(1,2,id='small')])
   ```

## 无效尝试

- **** — pytest inspects the signature and rejects **kwargs for parametrization; test still errors. (90% 失败率)
- **** — pytest treats 'args' as a single parameter, breaking tuple unpacking. (80% 失败率)
