I think there's an `assert_raises` function in `numpy.testing`.