def test_assertWarnsWrongCategory(self):
        """
        Test assertWarns failure when the category is wrong.
        """
        def deprecated(a):
            warnings.warn("Foo deprecated", category=DeprecationWarning)
            return a
        self.assertRaises(self.failureException,
            self.assertWarns, UserWarning, "Foo deprecated", __file__,
            deprecated, 123)

        Test assertWarns failure when the category is wrong.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/test/test_assertions.py