def test_badAttributeWithConfiguredLogObserver(self):
        """
        C{--logger} with a non-existent object raises a L{UsageError}.
        """
        config = twistd.ServerOptions()
        e = self.assertRaises(UsageError, config.parseOptions,
                              ["--logger", "twisted.test.test_twistd.FOOBAR"])
        if sys.version_info <= (3, 5):
            self.assertTrue(
                e.args[0].startswith(
                    "Logger 'twisted.test.test_twistd.FOOBAR' could not be "
                    "imported: 'module' object has no attribute 'FOOBAR'"))
        else:
            self.assertTrue(
                e.args[0].startswith(
                    "Logger 'twisted.test.test_twistd.FOOBAR' could not be "
                    "imported: module 'twisted.test.test_twistd' "
                    "has no attribute 'FOOBAR'"))
        self.assertNotIn('\n', e.args[0])

        C{--logger} with a non-existent object raises a L{UsageError}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_twistd.py