# TypeError: '<' not supported between instances of 'int' and 'str'

- **ID:** `python/pytest-parametrize-id-special-chars`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Passing mixed types as `ids=` to `@pytest.mark.parametrize` (e.g. ids=[1, 'two']) causes pytest to sort them for display, which fails when comparing int and str.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.x | active | — | — |
| 8.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Cast all ids to strings:

@pytest.mark.parametrize('n', [1, 2, 3], ids=lambda n: f'case-{n}')
   ```
2. **** (90% success)
   ```
   Provide a callable for ids that returns unique strings:

ids=lambda v: str(v).replace(' ', '_')
   ```

## Dead Ends

- **** — Works, but loses readability; long parameter values produce unreadable test IDs. (30% fail)
- **** — Sorting mixed types raises the same TypeError before pytest even sees it. (90% fail)
