def test_undecodablePath(self):
        """
        A request whose path cannot be decoded as UTF-8 receives a not
        found response, and the failure is logged.
        """
        path = self.mktemp()
        if isinstance(path, bytes):
            path = path.decode('ascii')
        base = FilePath(path)
        base.makedirs()

        file = static.File(base.path)
        request = DummyRequest([b"\xff"])
        child = resource.getChildForRequest(file, request)

        d = self._render(child, request)
        def cbRendered(ignored):
            self.assertEqual(request.responseCode, 404)
            self.assertEqual(len(self.flushLoggedErrors(UnicodeDecodeError)),
                             1)
        d.addCallback(cbRendered)
        return d

        A request whose path cannot be decoded as UTF-8 receives a not
        found response, and the failure is logged.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_static.py