def test_avatar(self):
        """
        Test that the transport notifies the avatar of disconnections.
        """
        disconnected = [False]
        def logout():
            disconnected[0] = True
        self.proto.logoutFunction = logout
        self.proto.avatar = True

        self.proto.connectionLost(None)
        self.assertTrue(disconnected[0])

        Test that the transport notifies the avatar of disconnections.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_transport.py