# AssertionError: ValueError not raised by parse_input

- **ID:** `python/unittest-assert-raises-no-exception`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

assertRaises expects the callable to raise the specified exception. If the function returns normally (e.g., it was fixed, or the input is valid), the context manager's __exit__ receives no exception and the test fails.

## Version Compatibility

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

## Workarounds

1. **** (97% success)
   ```
   def parse_input(s):
    if not s:
        raise ValueError('empty input')
    return int(s)

# test
with self.assertRaises(ValueError):
    parse_input('')
   ```
2. **** (96% success)
   ```
   import pytest

def test_parse_input_empty():
    with pytest.raises(ValueError, match='empty input'):
        parse_input('')
   ```

## Dead Ends

- **** — assertRaisesRegex still requires the exception to be raised; an empty pattern matches anything but the exception absence still fails. (90% fail)
- **** — Reimplements assertRaises worse; loses the informative 'ValueError not raised' message and complicates the test. (70% fail)
