def assertWarns(self, callable, msg=""):
        r"""
        Test if :attr:`callable` raises a warning.
        """
        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)

        Test if :attr:`callable` raises a warning.
        
tests/cpu/common_utils.py