def __setattr__(self, name, value):
        if not 'method_calls' in self.__dict__:
            # allow all attribute setting until initialisation is complete
            return object.__setattr__(self, name, value)

        if (self._spec_set and self._mock_methods is not None and name not in
            self._mock_methods and name not in self.__dict__ and
            name not in _allowed_names):
            raise AttributeError("Mock object has no attribute '%s'" % name)
        if name in _unsupported_magics:
            msg = 'Attempting to set unsupported magic method %r.' % name
            raise AttributeError(msg)
        elif name in _all_magics:
            if self._mock_methods is not None and name not in self._mock_methods:
                raise AttributeError("Mock object has no attribute '%s'" % name)

            if isinstance(value, MagicProxy):
                setattr(type(self), name, value)
                return

            if not isinstance(value, Mock):
                setattr(type(self), name, _get_method(name, value))
                original = value
                real = lambda *args, **kw: original(self, *args, **kw)
                value = mocksignature(value, real, skipfirst=True)
            else:
                setattr(type(self), name, value)
        return object.__setattr__(self, name, value)
dataset/ETHPy150Open sibson/vncdotool/tests/unit/mock.py/Mock.__setattr__/original