Skip to content

Instantly share code, notes, and snippets.

@voidspace
Created March 5, 2011 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voidspace/856510 to your computer and use it in GitHub Desktop.
Save voidspace/856510 to your computer and use it in GitHub Desktop.
Correct a mock example for the python mock comparison.
diff --git a/docs/comparison.rst b/docs/comparison.rst
index 391312a..1357e11 100644
--- a/docs/comparison.rst
+++ b/docs/comparison.rst
@@ -177,9 +177,8 @@ Creating partial mocks
.. doctest:: creating_partial_mocks
>>> # mock
- >>> my_mock = mock.Mock(spec=SomeObject)
- >>> my_mock.some_method.return_value = "value"
- >>> assertEqual("value", my_mock.some_method())
+ >>> SomeObject.some_method = mock.Mock(return_value='value')
+ >>> assertEqual("value", SomeObject.some_method())
>>> # Flexmock
>>> flexmock(SomeObject).should_receive("some_method").and_return('value')
diff --git a/docs/conf.py b/docs/conf.py
index 0662c90..724cc1d 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -16,7 +16,7 @@ import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.insert(0, os.path.abspath('.'))
+sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
diff --git a/docs/index.rst b/docs/index.rst
index f89579b..e33051a 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -8,10 +8,3 @@
comparison
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment