1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/python/mock-1.0.0/html/index.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,529 @@ 1.4 + 1.5 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 1.6 + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 1.7 + 1.8 + 1.9 +<html xmlns="http://www.w3.org/1999/xhtml"> 1.10 + <head> 1.11 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 1.12 + 1.13 + <title>Mock - Mocking and Testing Library — Mock 1.0.0 documentation</title> 1.14 + 1.15 + <link rel="stylesheet" href="_static/nature.css" type="text/css" /> 1.16 + <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> 1.17 + 1.18 + <script type="text/javascript"> 1.19 + var DOCUMENTATION_OPTIONS = { 1.20 + URL_ROOT: '', 1.21 + VERSION: '1.0.0', 1.22 + COLLAPSE_INDEX: false, 1.23 + FILE_SUFFIX: '.html', 1.24 + HAS_SOURCE: true 1.25 + }; 1.26 + </script> 1.27 + <script type="text/javascript" src="_static/jquery.js"></script> 1.28 + <script type="text/javascript" src="_static/underscore.js"></script> 1.29 + <script type="text/javascript" src="_static/doctools.js"></script> 1.30 + <link rel="top" title="Mock 1.0.0 documentation" href="#" /> 1.31 + <link rel="next" title="The Mock Class" href="mock.html" /> 1.32 + </head> 1.33 + <body> 1.34 + <div class="related"> 1.35 + <h3>Navigation</h3> 1.36 + <ul> 1.37 + <li class="right" style="margin-right: 10px"> 1.38 + <a href="genindex.html" title="General Index" 1.39 + accesskey="I">index</a></li> 1.40 + <li class="right" > 1.41 + <a href="mock.html" title="The Mock Class" 1.42 + accesskey="N">next</a> |</li> 1.43 + <li><a href="#">Mock 1.0.0 documentation</a> »</li> 1.44 + </ul> 1.45 + </div> 1.46 + 1.47 + <div class="document"> 1.48 + <div class="documentwrapper"> 1.49 + <div class="bodywrapper"> 1.50 + <div class="body"> 1.51 + 1.52 + <div class="section" id="mock-mocking-and-testing-library"> 1.53 +<h1>Mock - Mocking and Testing Library<a class="headerlink" href="#mock-mocking-and-testing-library" title="Permalink to this headline">¶</a></h1> 1.54 +<table class="docutils field-list" frame="void" rules="none"> 1.55 +<col class="field-name" /> 1.56 +<col class="field-body" /> 1.57 +<tbody valign="top"> 1.58 +<tr class="field-odd field"><th class="field-name">Author:</th><td class="field-body"><a class="reference external" href="http://www.voidspace.org.uk/python/weblog/index.shtml">Michael Foord</a></td> 1.59 +</tr> 1.60 +<tr class="field-even field"><th class="field-name">Version:</th><td class="field-body">1.0.0</td> 1.61 +</tr> 1.62 +<tr class="field-odd field"><th class="field-name">Date:</th><td class="field-body">2012/10/07</td> 1.63 +</tr> 1.64 +<tr class="field-even field"><th class="field-name">Homepage:</th><td class="field-body"><a class="reference external" href="http://www.voidspace.org.uk/python/mock/">Mock Homepage</a></td> 1.65 +</tr> 1.66 +<tr class="field-odd field"><th class="field-name">Download:</th><td class="field-body"><a class="reference external" href="http://pypi.python.org/pypi/mock">Mock on PyPI</a></td> 1.67 +</tr> 1.68 +<tr class="field-even field"><th class="field-name">Documentation:</th><td class="field-body"><a class="reference external" href="http://www.voidspace.org.uk/downloads/mock-1.0.0.pdf">PDF Documentation</a></td> 1.69 +</tr> 1.70 +<tr class="field-odd field"><th class="field-name">License:</th><td class="field-body"><a class="reference external" href="http://www.voidspace.org.uk/python/license.shtml">BSD License</a></td> 1.71 +</tr> 1.72 +<tr class="field-even field"><th class="field-name">Support:</th><td class="field-body"><a class="reference external" href="http://lists.idyll.org/listinfo/testing-in-python">Mailing list (testing-in-python@lists.idyll.org)</a></td> 1.73 +</tr> 1.74 +<tr class="field-odd field"><th class="field-name">Issue tracker:</th><td class="field-body"><a class="reference external" href="http://code.google.com/p/mock/issues/list">Google code project</a></td> 1.75 +</tr> 1.76 +</tbody> 1.77 +</table> 1.78 +<span class="target" id="module-mock"></span><p id="index-0">mock is a library for testing in Python. It allows you to replace parts of 1.79 +your system under test with mock objects and make assertions about how they 1.80 +have been used.</p> 1.81 +<p>mock is now part of the Python standard library, available as <a class="reference external" href="http://docs.python.org/py3k/library/unittest.mock.html#module-unittest.mock">unittest.mock</a> 1.82 +in Python 3.3 onwards.</p> 1.83 +<p>mock provides a core <a class="reference internal" href="mock.html#mock.Mock" title="mock.Mock"><tt class="xref py py-class docutils literal"><span class="pre">Mock</span></tt></a> class removing the need to create a host 1.84 +of stubs throughout your test suite. After performing an action, you can make 1.85 +assertions about which methods / attributes were used and arguments they were 1.86 +called with. You can also specify return values and set needed attributes in 1.87 +the normal way.</p> 1.88 +<p>Additionally, mock provides a <a class="reference internal" href="patch.html#mock.patch" title="mock.patch"><tt class="xref py py-func docutils literal"><span class="pre">patch()</span></tt></a> decorator that handles patching 1.89 +module and class level attributes within the scope of a test, along with 1.90 +<a class="reference internal" href="sentinel.html#mock.sentinel" title="mock.sentinel"><tt class="xref py py-const docutils literal"><span class="pre">sentinel</span></tt></a> for creating unique objects. See the <a class="reference internal" href="#quick-guide">quick guide</a> for 1.91 +some examples of how to use <a class="reference internal" href="mock.html#mock.Mock" title="mock.Mock"><tt class="xref py py-class docutils literal"><span class="pre">Mock</span></tt></a>, <a class="reference internal" href="magicmock.html#mock.MagicMock" title="mock.MagicMock"><tt class="xref py py-class docutils literal"><span class="pre">MagicMock</span></tt></a> and 1.92 +<a class="reference internal" href="patch.html#mock.patch" title="mock.patch"><tt class="xref py py-func docutils literal"><span class="pre">patch()</span></tt></a>.</p> 1.93 +<p>Mock is very easy to use and is designed for use with 1.94 +<a class="reference external" href="http://pypi.python.org/pypi/unittest2">unittest</a>. Mock is based on 1.95 +the ‘action -> assertion’ pattern instead of <cite>‘record -> replay’</cite> used by many 1.96 +mocking frameworks.</p> 1.97 +<p>mock is tested on Python versions 2.4-2.7, Python 3 plus the latest versions of 1.98 +Jython and PyPy.</p> 1.99 +<div class="section" id="api-documentation"> 1.100 +<h2>API Documentation<a class="headerlink" href="#api-documentation" title="Permalink to this headline">¶</a></h2> 1.101 +<div class="toctree-wrapper compound"> 1.102 +<ul> 1.103 +<li class="toctree-l1"><a class="reference internal" href="mock.html">The Mock Class</a></li> 1.104 +<li class="toctree-l1"><a class="reference internal" href="mock.html#calling">Calling</a></li> 1.105 +<li class="toctree-l1"><a class="reference internal" href="mock.html#deleting-attributes">Deleting Attributes</a></li> 1.106 +<li class="toctree-l1"><a class="reference internal" href="mock.html#attaching-mocks-as-attributes">Attaching Mocks as Attributes</a></li> 1.107 +<li class="toctree-l1"><a class="reference internal" href="patch.html">Patch Decorators</a><ul> 1.108 +<li class="toctree-l2"><a class="reference internal" href="patch.html#patch">patch</a></li> 1.109 +<li class="toctree-l2"><a class="reference internal" href="patch.html#patch-object">patch.object</a></li> 1.110 +<li class="toctree-l2"><a class="reference internal" href="patch.html#patch-dict">patch.dict</a></li> 1.111 +<li class="toctree-l2"><a class="reference internal" href="patch.html#patch-multiple">patch.multiple</a></li> 1.112 +<li class="toctree-l2"><a class="reference internal" href="patch.html#patch-methods-start-and-stop">patch methods: start and stop</a></li> 1.113 +<li class="toctree-l2"><a class="reference internal" href="patch.html#test-prefix">TEST_PREFIX</a></li> 1.114 +<li class="toctree-l2"><a class="reference internal" href="patch.html#nesting-patch-decorators">Nesting Patch Decorators</a></li> 1.115 +<li class="toctree-l2"><a class="reference internal" href="patch.html#where-to-patch">Where to patch</a></li> 1.116 +<li class="toctree-l2"><a class="reference internal" href="patch.html#patching-descriptors-and-proxy-objects">Patching Descriptors and Proxy Objects</a></li> 1.117 +</ul> 1.118 +</li> 1.119 +<li class="toctree-l1"><a class="reference internal" href="helpers.html">Helpers</a><ul> 1.120 +<li class="toctree-l2"><a class="reference internal" href="helpers.html#call">call</a></li> 1.121 +<li class="toctree-l2"><a class="reference internal" href="helpers.html#create-autospec">create_autospec</a></li> 1.122 +<li class="toctree-l2"><a class="reference internal" href="helpers.html#any">ANY</a></li> 1.123 +<li class="toctree-l2"><a class="reference internal" href="helpers.html#filter-dir">FILTER_DIR</a></li> 1.124 +<li class="toctree-l2"><a class="reference internal" href="helpers.html#mock-open">mock_open</a></li> 1.125 +<li class="toctree-l2"><a class="reference internal" href="helpers.html#autospeccing">Autospeccing</a></li> 1.126 +</ul> 1.127 +</li> 1.128 +<li class="toctree-l1"><a class="reference internal" href="sentinel.html">Sentinel</a><ul> 1.129 +<li class="toctree-l2"><a class="reference internal" href="sentinel.html#sentinel-example">Sentinel Example</a></li> 1.130 +</ul> 1.131 +</li> 1.132 +<li class="toctree-l1"><a class="reference internal" href="magicmock.html">Mocking Magic Methods</a></li> 1.133 +<li class="toctree-l1"><a class="reference internal" href="magicmock.html#magic-mock">Magic Mock</a></li> 1.134 +</ul> 1.135 +</div> 1.136 +</div> 1.137 +<div class="section" id="user-guide"> 1.138 +<h2>User Guide<a class="headerlink" href="#user-guide" title="Permalink to this headline">¶</a></h2> 1.139 +<div class="toctree-wrapper compound"> 1.140 +<ul> 1.141 +<li class="toctree-l1"><a class="reference internal" href="getting-started.html">Getting Started with Mock</a><ul> 1.142 +<li class="toctree-l2"><a class="reference internal" href="getting-started.html#using-mock">Using Mock</a></li> 1.143 +<li class="toctree-l2"><a class="reference internal" href="getting-started.html#patch-decorators">Patch Decorators</a></li> 1.144 +</ul> 1.145 +</li> 1.146 +<li class="toctree-l1"><a class="reference internal" href="examples.html">Further Examples</a><ul> 1.147 +<li class="toctree-l2"><a class="reference internal" href="examples.html#mocking-chained-calls">Mocking chained calls</a></li> 1.148 +<li class="toctree-l2"><a class="reference internal" href="examples.html#partial-mocking">Partial mocking</a></li> 1.149 +<li class="toctree-l2"><a class="reference internal" href="examples.html#mocking-a-generator-method">Mocking a Generator Method</a></li> 1.150 +<li class="toctree-l2"><a class="reference internal" href="examples.html#applying-the-same-patch-to-every-test-method">Applying the same patch to every test method</a></li> 1.151 +<li class="toctree-l2"><a class="reference internal" href="examples.html#mocking-unbound-methods">Mocking Unbound Methods</a></li> 1.152 +<li class="toctree-l2"><a class="reference internal" href="examples.html#checking-multiple-calls-with-mock">Checking multiple calls with mock</a></li> 1.153 +<li class="toctree-l2"><a class="reference internal" href="examples.html#coping-with-mutable-arguments">Coping with mutable arguments</a></li> 1.154 +<li class="toctree-l2"><a class="reference internal" href="examples.html#raising-exceptions-on-attribute-access">Raising exceptions on attribute access</a></li> 1.155 +<li class="toctree-l2"><a class="reference internal" href="examples.html#multiple-calls-with-different-effects">Multiple calls with different effects</a></li> 1.156 +<li class="toctree-l2"><a class="reference internal" href="examples.html#nesting-patches">Nesting Patches</a></li> 1.157 +<li class="toctree-l2"><a class="reference internal" href="examples.html#mocking-a-dictionary-with-magicmock">Mocking a dictionary with MagicMock</a></li> 1.158 +<li class="toctree-l2"><a class="reference internal" href="examples.html#mock-subclasses-and-their-attributes">Mock subclasses and their attributes</a></li> 1.159 +<li class="toctree-l2"><a class="reference internal" href="examples.html#mocking-imports-with-patch-dict">Mocking imports with patch.dict</a></li> 1.160 +<li class="toctree-l2"><a class="reference internal" href="examples.html#tracking-order-of-calls-and-less-verbose-call-assertions">Tracking order of calls and less verbose call assertions</a></li> 1.161 +<li class="toctree-l2"><a class="reference internal" href="examples.html#more-complex-argument-matching">More complex argument matching</a></li> 1.162 +<li class="toctree-l2"><a class="reference internal" href="examples.html#less-verbose-configuration-of-mock-objects">Less verbose configuration of mock objects</a></li> 1.163 +<li class="toctree-l2"><a class="reference internal" href="examples.html#matching-any-argument-in-assertions">Matching any argument in assertions</a></li> 1.164 +<li class="toctree-l2"><a class="reference internal" href="examples.html#mocking-properties">Mocking Properties</a></li> 1.165 +<li class="toctree-l2"><a class="reference internal" href="examples.html#mocking-open">Mocking open</a></li> 1.166 +<li class="toctree-l2"><a class="reference internal" href="examples.html#mocks-without-some-attributes">Mocks without some attributes</a></li> 1.167 +</ul> 1.168 +</li> 1.169 +<li class="toctree-l1"><a class="reference internal" href="compare.html">Mock Library Comparison</a><ul> 1.170 +<li class="toctree-l2"><a class="reference internal" href="compare.html#simple-fake-object">Simple fake object</a></li> 1.171 +<li class="toctree-l2"><a class="reference internal" href="compare.html#simple-mock">Simple mock</a></li> 1.172 +<li class="toctree-l2"><a class="reference internal" href="compare.html#creating-partial-mocks">Creating partial mocks</a></li> 1.173 +<li class="toctree-l2"><a class="reference internal" href="compare.html#ensure-calls-are-made-in-specific-order">Ensure calls are made in specific order</a></li> 1.174 +<li class="toctree-l2"><a class="reference internal" href="compare.html#raising-exceptions">Raising exceptions</a></li> 1.175 +<li class="toctree-l2"><a class="reference internal" href="compare.html#override-new-instances-of-a-class">Override new instances of a class</a></li> 1.176 +<li class="toctree-l2"><a class="reference internal" href="compare.html#call-the-same-method-multiple-times">Call the same method multiple times</a></li> 1.177 +<li class="toctree-l2"><a class="reference internal" href="compare.html#mock-chained-methods">Mock chained methods</a></li> 1.178 +<li class="toctree-l2"><a class="reference internal" href="compare.html#mocking-a-context-manager">Mocking a context manager</a></li> 1.179 +<li class="toctree-l2"><a class="reference internal" href="compare.html#mocking-the-builtin-open-used-as-a-context-manager">Mocking the builtin open used as a context manager</a></li> 1.180 +</ul> 1.181 +</li> 1.182 +<li class="toctree-l1"><a class="reference internal" href="changelog.html">CHANGELOG</a><ul> 1.183 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-1-0-0">2012/10/07 Version 1.0.0</a></li> 1.184 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-1-0-0-beta-1">2012/07/13 Version 1.0.0 beta 1</a></li> 1.185 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-1-0-0-alpha-2">2012/05/04 Version 1.0.0 alpha 2</a></li> 1.186 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-1-0-0-alpha-1">2012/03/25 Version 1.0.0 alpha 1</a></li> 1.187 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-8-0">2012/02/13 Version 0.8.0</a></li> 1.188 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-8-0-release-candidate-2">2012/01/10 Version 0.8.0 release candidate 2</a></li> 1.189 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-8-0-release-candidate-1">2011/12/29 Version 0.8.0 release candidate 1</a></li> 1.190 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-8-0-beta-4">2011/10/09 Version 0.8.0 beta 4</a></li> 1.191 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-8-0-beta-3">2011/08/15 Version 0.8.0 beta 3</a></li> 1.192 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-8-0-beta-2">2011/08/05 Version 0.8.0 beta 2</a></li> 1.193 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-8-0-beta-1">2011/07/25 Version 0.8.0 beta 1</a></li> 1.194 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-8-0-alpha-2">2011/07/16 Version 0.8.0 alpha 2</a></li> 1.195 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-8-0-alpha-1">2011/06/14 Version 0.8.0 alpha 1</a></li> 1.196 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7-2">2011/05/30 Version 0.7.2</a></li> 1.197 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7-1">2011/05/06 Version 0.7.1</a></li> 1.198 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7-0">2011/03/05 Version 0.7.0</a></li> 1.199 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7-0-rc-1">2011/02/16 Version 0.7.0 RC 1</a></li> 1.200 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7-0-beta-4">2010/11/12 Version 0.7.0 beta 4</a></li> 1.201 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7-0-beta-3">2010/09/18 Version 0.7.0 beta 3</a></li> 1.202 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7-0-beta-2">2010/06/23 Version 0.7.0 beta 2</a></li> 1.203 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7-0-beta-1">2010/06/22 Version 0.7.0 beta 1</a></li> 1.204 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-6-0">2009/08/22 Version 0.6.0</a></li> 1.205 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-5-0">2009/04/17 Version 0.5.0</a></li> 1.206 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-4-0">2008/10/12 Version 0.4.0</a></li> 1.207 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-3-1">2007/12/03 Version 0.3.1</a></li> 1.208 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-3-0">2007/11/30 Version 0.3.0</a></li> 1.209 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-2-1">2007/11/21 Version 0.2.1</a></li> 1.210 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-2-0">2007/11/20 Version 0.2.0</a></li> 1.211 +<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-1-0">2007/11/19 Version 0.1.0</a></li> 1.212 +</ul> 1.213 +</li> 1.214 +<li class="toctree-l1"><a class="reference internal" href="changelog.html#todo-and-limitations">TODO and Limitations</a></li> 1.215 +</ul> 1.216 +</div> 1.217 +</div> 1.218 +<div class="section" id="installing"> 1.219 +<span id="index-1"></span><h2>Installing<a class="headerlink" href="#installing" title="Permalink to this headline">¶</a></h2> 1.220 +<p>The current version is 1.0.0. Mock is stable and widely used. If you do 1.221 +find any bugs, or have suggestions for improvements / extensions 1.222 +then please contact us.</p> 1.223 +<ul class="simple"> 1.224 +<li><a class="reference external" href="http://pypi.python.org/pypi/mock">mock on PyPI</a></li> 1.225 +<li><a class="reference external" href="http://www.voidspace.org.uk/downloads/mock-1.0.0.pdf">mock documentation as PDF</a></li> 1.226 +<li><a class="reference external" href="http://code.google.com/p/mock/">Google Code Home & Mercurial Repository</a></li> 1.227 +</ul> 1.228 +<span class="target" id="index-2"></span><p id="index-3">You can checkout the latest development version from the Google Code Mercurial 1.229 +repository with the following command:</p> 1.230 +<blockquote> 1.231 +<div><tt class="docutils literal"><span class="pre">hg</span> <span class="pre">clone</span> <span class="pre">https://mock.googlecode.com/hg/</span> <span class="pre">mock</span></tt></div></blockquote> 1.232 +<span class="target" id="index-4"></span><span class="target" id="index-5"></span><p id="index-6">If you have pip, setuptools or distribute you can install mock with:</p> 1.233 +<blockquote> 1.234 +<div><div class="line-block"> 1.235 +<div class="line"><tt class="docutils literal"><span class="pre">easy_install</span> <span class="pre">-U</span> <span class="pre">mock</span></tt></div> 1.236 +<div class="line"><tt class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">-U</span> <span class="pre">mock</span></tt></div> 1.237 +</div> 1.238 +</div></blockquote> 1.239 +<p>Alternatively you can download the mock distribution from PyPI and after 1.240 +unpacking run:</p> 1.241 +<blockquote> 1.242 +<div><tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">install</span></tt></div></blockquote> 1.243 +</div> 1.244 +<div class="section" id="quick-guide"> 1.245 +<h2>Quick Guide<a class="headerlink" href="#quick-guide" title="Permalink to this headline">¶</a></h2> 1.246 +<p><a class="reference internal" href="mock.html#mock.Mock" title="mock.Mock"><tt class="xref py py-class docutils literal"><span class="pre">Mock</span></tt></a> and <a class="reference internal" href="magicmock.html#mock.MagicMock" title="mock.MagicMock"><tt class="xref py py-class docutils literal"><span class="pre">MagicMock</span></tt></a> objects create all attributes and 1.247 +methods as you access them and store details of how they have been used. You 1.248 +can configure them, to specify return values or limit what attributes are 1.249 +available, and then make assertions about how they have been used:</p> 1.250 +<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">MagicMock</span> 1.251 +<span class="gp">>>> </span><span class="n">thing</span> <span class="o">=</span> <span class="n">ProductionClass</span><span class="p">()</span> 1.252 +<span class="gp">>>> </span><span class="n">thing</span><span class="o">.</span><span class="n">method</span> <span class="o">=</span> <span class="n">MagicMock</span><span class="p">(</span><span class="n">return_value</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span> 1.253 +<span class="gp">>>> </span><span class="n">thing</span><span class="o">.</span><span class="n">method</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s">'value'</span><span class="p">)</span> 1.254 +<span class="go">3</span> 1.255 +<span class="gp">>>> </span><span class="n">thing</span><span class="o">.</span><span class="n">method</span><span class="o">.</span><span class="n">assert_called_with</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s">'value'</span><span class="p">)</span> 1.256 +</pre></div> 1.257 +</div> 1.258 +<p><tt class="xref py py-attr docutils literal"><span class="pre">side_effect</span></tt> allows you to perform side effects, including raising an 1.259 +exception when a mock is called:</p> 1.260 +<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">mock</span> <span class="o">=</span> <span class="n">Mock</span><span class="p">(</span><span class="n">side_effect</span><span class="o">=</span><span class="ne">KeyError</span><span class="p">(</span><span class="s">'foo'</span><span class="p">))</span> 1.261 +<span class="gp">>>> </span><span class="n">mock</span><span class="p">()</span> 1.262 +<span class="gt">Traceback (most recent call last):</span> 1.263 + <span class="c">...</span> 1.264 +<span class="gr">KeyError</span>: <span class="n">'foo'</span> 1.265 + 1.266 +<span class="gp">>>> </span><span class="n">values</span> <span class="o">=</span> <span class="p">{</span><span class="s">'a'</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s">'b'</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s">'c'</span><span class="p">:</span> <span class="mi">3</span><span class="p">}</span> 1.267 +<span class="gp">>>> </span><span class="k">def</span> <span class="nf">side_effect</span><span class="p">(</span><span class="n">arg</span><span class="p">):</span> 1.268 +<span class="gp">... </span> <span class="k">return</span> <span class="n">values</span><span class="p">[</span><span class="n">arg</span><span class="p">]</span> 1.269 +<span class="gp">...</span> 1.270 +<span class="gp">>>> </span><span class="n">mock</span><span class="o">.</span><span class="n">side_effect</span> <span class="o">=</span> <span class="n">side_effect</span> 1.271 +<span class="gp">>>> </span><span class="n">mock</span><span class="p">(</span><span class="s">'a'</span><span class="p">),</span> <span class="n">mock</span><span class="p">(</span><span class="s">'b'</span><span class="p">),</span> <span class="n">mock</span><span class="p">(</span><span class="s">'c'</span><span class="p">)</span> 1.272 +<span class="go">(1, 2, 3)</span> 1.273 +<span class="gp">>>> </span><span class="n">mock</span><span class="o">.</span><span class="n">side_effect</span> <span class="o">=</span> <span class="p">[</span><span class="mi">5</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span> 1.274 +<span class="gp">>>> </span><span class="n">mock</span><span class="p">(),</span> <span class="n">mock</span><span class="p">(),</span> <span class="n">mock</span><span class="p">()</span> 1.275 +<span class="go">(5, 4, 3)</span> 1.276 +</pre></div> 1.277 +</div> 1.278 +<p>Mock has many other ways you can configure it and control its behaviour. For 1.279 +example the <cite>spec</cite> argument configures the mock to take its specification 1.280 +from another object. Attempting to access attributes or methods on the mock 1.281 +that don’t exist on the spec will fail with an <cite>AttributeError</cite>.</p> 1.282 +<p>The <a class="reference internal" href="patch.html#mock.patch" title="mock.patch"><tt class="xref py py-func docutils literal"><span class="pre">patch()</span></tt></a> decorator / context manager makes it easy to mock classes or 1.283 +objects in a module under test. The object you specify will be replaced with a 1.284 +mock (or other object) during the test and restored when the test ends:</p> 1.285 +<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">patch</span> 1.286 +<span class="gp">>>> </span><span class="nd">@patch</span><span class="p">(</span><span class="s">'module.ClassName2'</span><span class="p">)</span> 1.287 +<span class="gp">... </span><span class="nd">@patch</span><span class="p">(</span><span class="s">'module.ClassName1'</span><span class="p">)</span> 1.288 +<span class="gp">... </span><span class="k">def</span> <span class="nf">test</span><span class="p">(</span><span class="n">MockClass1</span><span class="p">,</span> <span class="n">MockClass2</span><span class="p">):</span> 1.289 +<span class="gp">... </span> <span class="n">module</span><span class="o">.</span><span class="n">ClassName1</span><span class="p">()</span> 1.290 +<span class="gp">... </span> <span class="n">module</span><span class="o">.</span><span class="n">ClassName2</span><span class="p">()</span> 1.291 + 1.292 +<span class="gp">... </span> <span class="k">assert</span> <span class="n">MockClass1</span> <span class="ow">is</span> <span class="n">module</span><span class="o">.</span><span class="n">ClassName1</span> 1.293 +<span class="gp">... </span> <span class="k">assert</span> <span class="n">MockClass2</span> <span class="ow">is</span> <span class="n">module</span><span class="o">.</span><span class="n">ClassName2</span> 1.294 +<span class="gp">... </span> <span class="k">assert</span> <span class="n">MockClass1</span><span class="o">.</span><span class="n">called</span> 1.295 +<span class="gp">... </span> <span class="k">assert</span> <span class="n">MockClass2</span><span class="o">.</span><span class="n">called</span> 1.296 +<span class="gp">...</span> 1.297 +<span class="gp">>>> </span><span class="n">test</span><span class="p">()</span> 1.298 +</pre></div> 1.299 +</div> 1.300 +<div class="admonition note"> 1.301 +<p class="first admonition-title">Note</p> 1.302 +<p>When you nest patch decorators the mocks are passed in to the decorated 1.303 +function in the same order they applied (the normal <em>python</em> order that 1.304 +decorators are applied). This means from the bottom up, so in the example 1.305 +above the mock for <cite>module.ClassName1</cite> is passed in first.</p> 1.306 +<p class="last">With <cite>patch</cite> it matters that you patch objects in the namespace where they 1.307 +are looked up. This is normally straightforward, but for a quick guide 1.308 +read <a class="reference internal" href="patch.html#where-to-patch"><em>where to patch</em></a>.</p> 1.309 +</div> 1.310 +<p>As well as a decorator <cite>patch</cite> can be used as a context manager in a with 1.311 +statement:</p> 1.312 +<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">with</span> <span class="n">patch</span><span class="o">.</span><span class="n">object</span><span class="p">(</span><span class="n">ProductionClass</span><span class="p">,</span> <span class="s">'method'</span><span class="p">,</span> <span class="n">return_value</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span> <span class="k">as</span> <span class="n">mock_method</span><span class="p">:</span> 1.313 +<span class="gp">... </span> <span class="n">thing</span> <span class="o">=</span> <span class="n">ProductionClass</span><span class="p">()</span> 1.314 +<span class="gp">... </span> <span class="n">thing</span><span class="o">.</span><span class="n">method</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span> 1.315 +<span class="gp">...</span> 1.316 +<span class="gp">>>> </span><span class="n">mock_method</span><span class="o">.</span><span class="n">assert_called_once_with</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span> 1.317 +</pre></div> 1.318 +</div> 1.319 +<p>There is also <a class="reference internal" href="patch.html#mock.patch.dict" title="mock.patch.dict"><tt class="xref py py-func docutils literal"><span class="pre">patch.dict()</span></tt></a> for setting values in a dictionary just 1.320 +during a scope and restoring the dictionary to its original state when the test 1.321 +ends:</p> 1.322 +<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">foo</span> <span class="o">=</span> <span class="p">{</span><span class="s">'key'</span><span class="p">:</span> <span class="s">'value'</span><span class="p">}</span> 1.323 +<span class="gp">>>> </span><span class="n">original</span> <span class="o">=</span> <span class="n">foo</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> 1.324 +<span class="gp">>>> </span><span class="k">with</span> <span class="n">patch</span><span class="o">.</span><span class="n">dict</span><span class="p">(</span><span class="n">foo</span><span class="p">,</span> <span class="p">{</span><span class="s">'newkey'</span><span class="p">:</span> <span class="s">'newvalue'</span><span class="p">},</span> <span class="n">clear</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span> 1.325 +<span class="gp">... </span> <span class="k">assert</span> <span class="n">foo</span> <span class="o">==</span> <span class="p">{</span><span class="s">'newkey'</span><span class="p">:</span> <span class="s">'newvalue'</span><span class="p">}</span> 1.326 +<span class="gp">...</span> 1.327 +<span class="gp">>>> </span><span class="k">assert</span> <span class="n">foo</span> <span class="o">==</span> <span class="n">original</span> 1.328 +</pre></div> 1.329 +</div> 1.330 +<p>Mock supports the mocking of Python <a class="reference internal" href="magicmock.html#magic-methods"><em>magic methods</em></a>. The 1.331 +easiest way of using magic methods is with the <a class="reference internal" href="magicmock.html#mock.MagicMock" title="mock.MagicMock"><tt class="xref py py-class docutils literal"><span class="pre">MagicMock</span></tt></a> class. It 1.332 +allows you to do things like:</p> 1.333 +<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">mock</span> <span class="o">=</span> <span class="n">MagicMock</span><span class="p">()</span> 1.334 +<span class="gp">>>> </span><span class="n">mock</span><span class="o">.</span><span class="n">__str__</span><span class="o">.</span><span class="n">return_value</span> <span class="o">=</span> <span class="s">'foobarbaz'</span> 1.335 +<span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="n">mock</span><span class="p">)</span> 1.336 +<span class="go">'foobarbaz'</span> 1.337 +<span class="gp">>>> </span><span class="n">mock</span><span class="o">.</span><span class="n">__str__</span><span class="o">.</span><span class="n">assert_called_with</span><span class="p">()</span> 1.338 +</pre></div> 1.339 +</div> 1.340 +<p>Mock allows you to assign functions (or other Mock instances) to magic methods 1.341 +and they will be called appropriately. The <cite>MagicMock</cite> class is just a Mock 1.342 +variant that has all of the magic methods pre-created for you (well, all the 1.343 +useful ones anyway).</p> 1.344 +<p>The following is an example of using magic methods with the ordinary Mock 1.345 +class:</p> 1.346 +<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">mock</span> <span class="o">=</span> <span class="n">Mock</span><span class="p">()</span> 1.347 +<span class="gp">>>> </span><span class="n">mock</span><span class="o">.</span><span class="n">__str__</span> <span class="o">=</span> <span class="n">Mock</span><span class="p">(</span><span class="n">return_value</span><span class="o">=</span><span class="s">'wheeeeee'</span><span class="p">)</span> 1.348 +<span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="n">mock</span><span class="p">)</span> 1.349 +<span class="go">'wheeeeee'</span> 1.350 +</pre></div> 1.351 +</div> 1.352 +<p>For ensuring that the mock objects in your tests have the same api as the 1.353 +objects they are replacing, you can use <a class="reference internal" href="helpers.html#auto-speccing"><em>auto-speccing</em></a>. 1.354 +Auto-speccing can be done through the <cite>autospec</cite> argument to patch, or the 1.355 +<a class="reference internal" href="helpers.html#mock.create_autospec" title="mock.create_autospec"><tt class="xref py py-func docutils literal"><span class="pre">create_autospec()</span></tt></a> function. Auto-speccing creates mock objects that 1.356 +have the same attributes and methods as the objects they are replacing, and 1.357 +any functions and methods (including constructors) have the same call 1.358 +signature as the real object.</p> 1.359 +<p>This ensures that your mocks will fail in the same way as your production 1.360 +code if they are used incorrectly:</p> 1.361 +<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">create_autospec</span> 1.362 +<span class="gp">>>> </span><span class="k">def</span> <span class="nf">function</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">c</span><span class="p">):</span> 1.363 +<span class="gp">... </span> <span class="k">pass</span> 1.364 +<span class="gp">...</span> 1.365 +<span class="gp">>>> </span><span class="n">mock_function</span> <span class="o">=</span> <span class="n">create_autospec</span><span class="p">(</span><span class="n">function</span><span class="p">,</span> <span class="n">return_value</span><span class="o">=</span><span class="s">'fishy'</span><span class="p">)</span> 1.366 +<span class="gp">>>> </span><span class="n">mock_function</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span> 1.367 +<span class="go">'fishy'</span> 1.368 +<span class="gp">>>> </span><span class="n">mock_function</span><span class="o">.</span><span class="n">assert_called_once_with</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span> 1.369 +<span class="gp">>>> </span><span class="n">mock_function</span><span class="p">(</span><span class="s">'wrong arguments'</span><span class="p">)</span> 1.370 +<span class="gt">Traceback (most recent call last):</span> 1.371 + <span class="c">...</span> 1.372 +<span class="gr">TypeError</span>: <span class="n"><lambda>() takes exactly 3 arguments (1 given)</span> 1.373 +</pre></div> 1.374 +</div> 1.375 +<p><cite>create_autospec</cite> can also be used on classes, where it copies the signature of 1.376 +the <cite>__init__</cite> method, and on callable objects where it copies the signature of 1.377 +the <cite>__call__</cite> method.</p> 1.378 +<span class="target" id="index-7"></span></div> 1.379 +<div class="section" id="references"> 1.380 +<span id="index-8"></span><h2>References<a class="headerlink" href="#references" title="Permalink to this headline">¶</a></h2> 1.381 +<p>Articles, blog entries and other stuff related to testing with Mock:</p> 1.382 +<ul class="simple"> 1.383 +<li><a class="reference external" href="https://github.com/carljm/django-testing-slides/blob/master/models/30_no_database.md">Imposing a No DB Discipline on Django unit tests</a></li> 1.384 +<li><a class="reference external" href="https://github.com/dcramer/mock-django">mock-django: tools for mocking the Django ORM and models</a></li> 1.385 +<li><a class="reference external" href="https://blip.tv/file/4881513">PyCon 2011 Video: Testing with mock</a></li> 1.386 +<li><a class="reference external" href="http://noopenblockers.com/2012/01/06/mock-objects-in-python/">Mock objects in Python</a></li> 1.387 +<li><a class="reference external" href="http://blueprintforge.com/blog/2012/01/08/python-injecting-mock-objects-for-powerful-testing/">Python: Injecting Mock Objects for Powerful Testing</a></li> 1.388 +<li><a class="reference external" href="http://www.michaelpollmeier.com/python-mock-how-to-assert-a-substring-of-logger-output/">Python Mock: How to assert a substring of logger output</a></li> 1.389 +<li><a class="reference external" href="http://www.mattjmorrison.com/2011/09/mocking-django.html">Mocking Django</a></li> 1.390 +<li><a class="reference external" href="http://williamjohnbert.com/2011/07/how-to-unit-testing-in-django-with-mocking-and-patching/">Mocking dates and other classes that can’t be modified</a></li> 1.391 +<li><a class="reference external" href="http://konryd.blogspot.com/2010/06/mock-recipies.html">Mock recipes</a></li> 1.392 +<li><a class="reference external" href="http://konryd.blogspot.com/2010/05/mockity-mock-mock-some-love-for-mock.html">Mockity mock mock - some love for the mock module</a></li> 1.393 +<li><a class="reference external" href="http://mattsnider.com/python/mock-and-coverage/">Coverage and Mock (with django)</a></li> 1.394 +<li><a class="reference external" href="http://www.insomnihack.com/?p=194">Python Unit Testing with Mock</a></li> 1.395 +<li><a class="reference external" href="http://myadventuresincoding.wordpress.com/2011/02/26/python-python-mock-cheat-sheet/">Getting started with Python Mock</a></li> 1.396 +<li><a class="reference external" href="http://tobyho.com/2011/03/24/smart-parameter-checks-in/">Smart Parameter Checks with mock</a></li> 1.397 +<li><a class="reference external" href="http://agiletesting.blogspot.com/2009/07/python-mock-testing-techniques-and.html">Python mock testing techniques and tools</a></li> 1.398 +<li><a class="reference external" href="http://techblog.ironfroggy.com/2008/10/how-to-test.html">How To Test Django Template Tags</a></li> 1.399 +<li><a class="reference external" href="http://pypap.blogspot.com/2008/10/newbie-nugget-unit-testing-with-mock.html">A presentation on Unit Testing with Mock</a></li> 1.400 +<li><a class="reference external" href="http://michael-a-nelson.blogspot.com/2008/09/mocking-with-django-and-google-app.html">Mocking with Django and Google AppEngine</a></li> 1.401 +</ul> 1.402 +<span class="target" id="index-9"></span></div> 1.403 +<div class="section" id="tests"> 1.404 +<span id="index-10"></span><h2>Tests<a class="headerlink" href="#tests" title="Permalink to this headline">¶</a></h2> 1.405 +<p>Mock uses <a class="reference external" href="http://pypi.python.org/pypi/unittest2">unittest2</a> for its own 1.406 +test suite. In order to run it, use the <cite>unit2</cite> script that comes with 1.407 +<cite>unittest2</cite> module on a checkout of the source repository:</p> 1.408 +<blockquote> 1.409 +<div><cite>unit2 discover</cite></div></blockquote> 1.410 +<p>If you have <a class="reference external" href="http://pypi.python.org/pypi/distribute">setuptools</a> as well as 1.411 +unittest2 you can run:</p> 1.412 +<blockquote> 1.413 +<div><tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">test</span></tt></div></blockquote> 1.414 +<p>On Python 3.2 you can use <tt class="docutils literal"><span class="pre">unittest</span></tt> module from the standard library.</p> 1.415 +<blockquote> 1.416 +<div><tt class="docutils literal"><span class="pre">python3.2</span> <span class="pre">-m</span> <span class="pre">unittest</span> <span class="pre">discover</span></tt></div></blockquote> 1.417 +<p id="index-11">On Python 3 the tests for unicode are skipped as they are not relevant. On 1.418 +Python 2.4 tests that use the with statements are skipped as the with statement 1.419 +is invalid syntax on Python 2.4.</p> 1.420 +</div> 1.421 +<div class="section" id="older-versions"> 1.422 +<span id="index-12"></span><h2>Older Versions<a class="headerlink" href="#older-versions" title="Permalink to this headline">¶</a></h2> 1.423 +<p>Documentation for older versions of mock:</p> 1.424 +<ul class="simple"> 1.425 +<li><a class="reference external" href="http://www.voidspace.org.uk/python/mock/0.8/">mock 0.8</a></li> 1.426 +<li><a class="reference external" href="http://www.voidspace.org.uk/python/mock/0.7/">mock 0.7</a></li> 1.427 +<li><a class="reference external" href="http://www.voidspace.org.uk/python/mock/0.6.0/">mock 0.6</a></li> 1.428 +</ul> 1.429 +<p>Docs from the in-development version of <cite>mock</cite> can be found at 1.430 +<a class="reference external" href="http://mock.readthedocs.org">mock.readthedocs.org</a>.</p> 1.431 +</div> 1.432 +<div class="section" id="terminology"> 1.433 +<h2>Terminology<a class="headerlink" href="#terminology" title="Permalink to this headline">¶</a></h2> 1.434 +<p>Terminology for objects used to replace other ones can be confusing. Terms 1.435 +like double, fake, mock, stub, and spy are all used with varying meanings.</p> 1.436 +<p>In <a class="reference external" href="http://xunitpatterns.com/Mocks,%20Fakes,%20Stubs%20and%20Dummies.html">classic mock terminology</a> 1.437 +<a class="reference internal" href="mock.html#mock.Mock" title="mock.Mock"><tt class="xref py py-class docutils literal"><span class="pre">mock.Mock</span></tt></a> is a <a class="reference external" href="http://xunitpatterns.com/Test%20Spy.html">spy</a> that 1.438 +allows for <em>post-mortem</em> examination. This is what I call the “action -> 1.439 +assertion” <a class="footnote-reference" href="#id2" id="id1">[1]</a> pattern of testing.</p> 1.440 +<p>I’m not however a fan of this “statically typed mocking terminology” 1.441 +promulgated by <a class="reference external" href="http://martinfowler.com/articles/mocksArentStubs.html">Martin Fowler</a>. It confuses usage 1.442 +patterns with implementation and prevents you from using natural terminology 1.443 +when discussing mocking.</p> 1.444 +<p>I much prefer duck typing, if an object used in your test suite looks like a 1.445 +mock object and quacks like a mock object then it’s fine to call it a mock, no 1.446 +matter what the implementation looks like.</p> 1.447 +<p>This terminology is perhaps more useful in less capable languages where 1.448 +different usage patterns will <em>require</em> different implementations. 1.449 +<cite>mock.Mock()</cite> is capable of being used in most of the different roles 1.450 +described by Fowler, except (annoyingly / frustratingly / ironically) a Mock 1.451 +itself!</p> 1.452 +<p>How about a simpler definition: a “mock object” is an object used to replace a 1.453 +real one in a system under test.</p> 1.454 +<table class="docutils footnote" frame="void" id="id2" rules="none"> 1.455 +<colgroup><col class="label" /><col /></colgroup> 1.456 +<tbody valign="top"> 1.457 +<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>This pattern is called “AAA” by some members of the testing community; 1.458 +“Arrange - Act - Assert”.</td></tr> 1.459 +</tbody> 1.460 +</table> 1.461 +</div> 1.462 +</div> 1.463 + 1.464 + 1.465 + </div> 1.466 + </div> 1.467 + </div> 1.468 + <div class="sphinxsidebar"> 1.469 + <div class="sphinxsidebarwrapper"> 1.470 + <h3><a href="#">Table Of Contents</a></h3> 1.471 + <ul> 1.472 +<li><a class="reference internal" href="#">Mock - Mocking and Testing Library</a><ul> 1.473 +<li><a class="reference internal" href="#api-documentation">API Documentation</a><ul> 1.474 +</ul> 1.475 +</li> 1.476 +<li><a class="reference internal" href="#user-guide">User Guide</a><ul> 1.477 +</ul> 1.478 +</li> 1.479 +<li><a class="reference internal" href="#installing">Installing</a></li> 1.480 +<li><a class="reference internal" href="#quick-guide">Quick Guide</a></li> 1.481 +<li><a class="reference internal" href="#references">References</a></li> 1.482 +<li><a class="reference internal" href="#tests">Tests</a></li> 1.483 +<li><a class="reference internal" href="#older-versions">Older Versions</a></li> 1.484 +<li><a class="reference internal" href="#terminology">Terminology</a></li> 1.485 +</ul> 1.486 +</li> 1.487 +</ul> 1.488 + 1.489 + <h4>Next topic</h4> 1.490 + <p class="topless"><a href="mock.html" 1.491 + title="next chapter">The Mock Class</a></p> 1.492 + <h3>This Page</h3> 1.493 + <ul class="this-page-menu"> 1.494 + <li><a href="_sources/index.txt" 1.495 + rel="nofollow">Show Source</a></li> 1.496 + </ul> 1.497 +<div id="searchbox" style="display: none"> 1.498 + <h3>Quick search</h3> 1.499 + <form class="search" action="search.html" method="get"> 1.500 + <input type="text" name="q" /> 1.501 + <input type="submit" value="Go" /> 1.502 + <input type="hidden" name="check_keywords" value="yes" /> 1.503 + <input type="hidden" name="area" value="default" /> 1.504 + </form> 1.505 + <p class="searchtip" style="font-size: 90%"> 1.506 + Enter search terms or a module, class or function name. 1.507 + </p> 1.508 +</div> 1.509 +<script type="text/javascript">$('#searchbox').show(0);</script> 1.510 + </div> 1.511 + </div> 1.512 + <div class="clearer"></div> 1.513 + </div> 1.514 + <div class="related"> 1.515 + <h3>Navigation</h3> 1.516 + <ul> 1.517 + <li class="right" style="margin-right: 10px"> 1.518 + <a href="genindex.html" title="General Index" 1.519 + >index</a></li> 1.520 + <li class="right" > 1.521 + <a href="mock.html" title="The Mock Class" 1.522 + >next</a> |</li> 1.523 + <li><a href="#">Mock 1.0.0 documentation</a> »</li> 1.524 + </ul> 1.525 + </div> 1.526 + <div class="footer"> 1.527 + © Copyright 2007-2012, Michael Foord & the mock team. 1.528 + Last updated on Oct 07, 2012. 1.529 + Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. 1.530 + </div> 1.531 + </body> 1.532 +</html> 1.533 \ No newline at end of file