> I found assert_warns now, but how is it supposed to be used?

As the docstring says: assert_warns(UserWarning, func, arg1, arg2,
kwarg1=foo...)