Use catch_warnings to test warnings.