Please use sklearn.utils.testing.assert_warns.