# AssertionError: ValueError not raised by my_function

- **ID:** `python/unittest-assertraises-not-raising`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The code under test does not raise the expected exception, or the exception is caught inside the function.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   Run the function in a Python shell and check if it raises ValueError. If not, fix the function or update the test to expect the correct exception.
   ```
2. **** (85% success)
   ```
   with pytest.raises(ValueError):
    my_function()
This provides clearer error messages and works with pytest's assertion introspection.
   ```

## Dead Ends

- **** — The test then passes even if no exception is raised, missing the intended validation. (90% fail)
- **** — This may pass but does not verify the correct exception type, reducing test effectiveness. (70% fail)
