def test_warningsModule(self):
        """
        L{LogBeginner.beginLoggingTo} will redirect the warnings of its
        warnings module into the logging system.
        """
        self.warningsModule.showwarning(
            "a message", DeprecationWarning, __file__, 1
        )
        x = []
        self.beginner.beginLoggingTo([x.append])
        self.warningsModule.showwarning(
            "another message", DeprecationWarning, __file__, 2
        )
        f = io.StringIO()
        self.warningsModule.showwarning(
            "yet another", DeprecationWarning, __file__, 3, file=f
        )
        self.assertEqual(
            self.warningsModule.warnings,
            [
                ("a message", DeprecationWarning, __file__, 1, None, None),
                ("yet another", DeprecationWarning, __file__, 3, f, None),
            ]
        )
        compareEvents(
            self, x,
            [dict(
                warning="another message",
                category=(
                    DeprecationWarning.__module__ + "." +
                    DeprecationWarning.__name__
                ),
                filename=__file__, lineno=2,
            )]
        )

        L{LogBeginner.beginLoggingTo} will redirect the warnings of its
        warnings module into the logging system.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/test/test_global.py