docs: def assert_warns_regex(warning_type, regex, msg_fmt="{msg}"):
      """Fail unless a warning with a message is issued inside the context.
  
      The message can be a regular expression string or object.
  
      >>> from warnings import warn
      >>> with assert_warns_regex(UserWarning, r"#\\d+"):
      ...     warn("Error #42", UserWarning)
      ...
      >>> with assert_warns_regex(UserWarning, r"Expected Error"):
      ...     warn("Generic Error", UserWarning)
      ...
      Traceback (most recent call last):
          ...
      AssertionError: no UserWarning matching 'Expected Error' issued
  
      The following msg_fmt arguments are supported:
      * msg - the default error message
      * exc_type - warning type
      * exc_name - warning type name
      * pattern - expected warning message as regular expression string
      """
  
      def test(warning):
          return re.search(regex, str(warning.message)) is not None
  
      context = AssertWarnsRegexContext(warning_type, regex, msg_fmt)
      context.add_test(test)
      return context