summaryrefslogtreecommitdiff
path: root/docs/magicmock.txt
diff options
context:
space:
mode:
authorfuzzyman <devnull@localhost>2010-10-18 22:35:34 +0000
committerfuzzyman <devnull@localhost>2010-10-18 22:35:34 +0000
commit82b8a44c195ee122dc7570cb9574cfe834ba6653 (patch)
treea3edb8aec71025bf4d81a0a9685b072874e8b389 /docs/magicmock.txt
parentcc1c9fbd3c23f2794c01c02aa39999cadf4f301f (diff)
downloadmock-82b8a44c195ee122dc7570cb9574cfe834ba6653.tar.gz
Attempting to set an unsupported magic method now raises an AttributeError
Change version number to 0.7.0 beta 4 Change copying test to work on Python 3 (no sys.maxint)
Diffstat (limited to 'docs/magicmock.txt')
-rw-r--r--docs/magicmock.txt14
1 files changed, 8 insertions, 6 deletions
diff --git a/docs/magicmock.txt b/docs/magicmock.txt
index b769ca2..40874df 100644
--- a/docs/magicmock.txt
+++ b/docs/magicmock.txt
@@ -30,14 +30,14 @@ the first argument [#]_.
>>> mock.__str__ = __str__
>>> str(mock)
'fooble'
-
+
>>> from mock import Mock
>>> mock = Mock()
>>> mock.__str__ = Mock()
>>> mock.__str__.return_value = 'fooble'
>>> str(mock)
'fooble'
-
+
>>> from mock import Mock
>>> mock = Mock()
>>> mock.__iter__ = Mock(return_value=iter([]))
@@ -90,7 +90,7 @@ The full list of supported magic methods is:
* Pickling: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``,
``__getnewargs__``, ``__getstate__`` and ``__setstate__``
-
+
The following methods are supported in Python 2 but don't exist in Python 3:
* ``__unicode__``, ``__long__``, ``__oct__``, ``__hex__`` and ``__nonzero__``
@@ -99,12 +99,14 @@ The following methods are supported in Python 3 but don't exist in Python 2:
* ``__bool__`` and ``__next__``
-The following methods exist but are *not* supported as they either can't be
-dynamically set or can cause problems:
+The following methods exist but are *not* supported as they are either in use by
+mock, can't be set dynamically or can cause problems:
+* ``__getattr__``, ``__setattr__``, ``__init__`` and ``__new__``
* ``__prepare__``, ``__instancecheck__``, ``__subclasscheck__``, ``__del__``
+
Magic Mock
==========
@@ -113,7 +115,7 @@ Magic Mock
``MagicMock`` is a subclass of :class:`Mock` with default implementations
of most of the magic methods. You can use ``MagicMock`` without having to
configure the magic methods yourself.
-
+
If you use the ``spec`` argument then *only* magic methods that exist in
the spec will be created.