def _compiler_dispatch(self, compiler, **kwargs):
    if hasattr(compiler, 'statement'):
        with mock.patch.object(compiler, 'statement', DontAccess()):
            return self.test_statement._compiler_dispatch(compiler, **kwargs)
    else:
        return self.test_statement._compiler_dispatch(compiler, **kwargs)
def _compiler_dispatch(self, compiler, **kwargs):
    if hasattr(compiler, 'statement'):
        with mock.patch.object(compiler, 'statement', DontAccess()):
            return self.test_statement._compiler_dispatch(compiler, **kwargs)
    else:
        return self.test_statement._compiler_dispatch(compiler, **kwargs)