def assertWarnsRegex(self, callable, regex, msg=""):
        r"""
        Test if :attr:`callable` raises any warning with message that contains
        the regex pattern :attr:`regex`.
        """
        with self._reset_warning_registry(), warnings.catch_warnings(record=True) as ws:
            warnings.simplefilter("always")  # allow any warning to be raised
            callable()
            self.assertTrue(len(ws) > 0, msg)
            found = any(re.search(regex, str(w.message)) is not None for w in ws)
            self.assertTrue(found, msg)

        Test if :attr:`callable` raises any warning with message that contains
        the regex pattern :attr:`regex`.
        
tests/cpu/common_utils.py