# Failed: DID NOT RAISE <class 'ValueError'>

- **ID:** `python/pytest-raises-no-exception`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The code block inside pytest.raises() did not raise the expected exception, indicating a bug or incorrect test assumption.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |

## Workarounds

1. **Review the code to ensure it raises the expected exception under the given conditions.** (90% success)
   ```
   Add print statements or debug to verify the code path.
   ```
2. **Use pytest.raises with match parameter to check exception message.** (85% success)
   ```
   with pytest.raises(ValueError, match='invalid value'): code_that_should_raise()
   ```

## Dead Ends

- **Adding a try-except block inside pytest.raises to catch the exception** — pytest.raises already handles exception catching; extra try-except may swallow the exception. (70% fail)
- **Changing the expected exception to a broader type** — This may mask the real issue where no exception is raised at all. (60% fail)
