You can use:

```python

from sklearn.utils.testing import assert_raise_message

assert_raise_message(ValueError, expected_msg, my_callable, args)
```

to check the content of a message.