def test_getSessionNonExistent(self):
        """
        L{site.getSession} raises a L{KeyError} if the session is not found.
        """
        site = server.Site(resource.Resource())

        self.assertRaises(KeyError, site.getSession, b'no-such-uid')

        L{site.getSession} raises a L{KeyError} if the session is not found.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_web.py