summaryrefslogtreecommitdiff
path: root/apidocs/testtools.matchers.__init__.html
diff options
context:
space:
mode:
Diffstat (limited to 'apidocs/testtools.matchers.__init__.html')
-rw-r--r--apidocs/testtools.matchers.__init__.html133
1 files changed, 133 insertions, 0 deletions
diff --git a/apidocs/testtools.matchers.__init__.html b/apidocs/testtools.matchers.__init__.html
new file mode 100644
index 0000000..4e753c1
--- /dev/null
+++ b/apidocs/testtools.matchers.__init__.html
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <title>testtools.matchers.__init__ : API documentation</title>
+
+ <meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
+ <link href="bootstrap.min.css" type="text/css" rel="stylesheet" />
+ <link href="apidocs.css" type="text/css" rel="stylesheet" />
+ </head>
+ <body>
+
+ <nav class="navbar navbar-default">
+ <div class="container">
+ <div class="navbar-header">
+ <a href="index.html" class="navbar-brand">
+ <a href="https://github.com/testing-cabal/testtools">testtools</a> API Documentation
+ </a>
+ </div>
+ </div>
+ </nav>
+
+ <div class="container">
+
+ <div class="page-header">
+ <h1 class="module"><code>testtools.matchers.__init__</code> <small>module documentation</small></h1>
+
+ <span id="partOf">
+ Part of <code><a href="testtools.html" class="code">testtools</a>.<a href="testtools.matchers.html" class="code">matchers</a></code>
+
+
+ </span>
+ </div>
+
+ <div class="extrasDocstring">
+
+ </div>
+
+ <div class="moduleDocstring">
+ <div><p>All the matchers.</p>
+<p>Matchers, a way to express complex assertions outside the testcase.</p>
+<p>Inspired by 'hamcrest'.</p>
+<p>Matcher provides the abstract API that all matchers need to implement.</p>
+<p>Bundled matchers are listed in __all__: a list can be obtained by running
+$ python -c 'import testtools.matchers; print testtools.matchers.__all__'</p><table class="fieldTable"></table></div>
+ </div>
+
+ <div id="splitTables">
+ <table class="children sortable" id="id30">
+
+ <tr class="class">
+
+ <td>Class</td>
+ <td><a href="testtools.matchers.ContainedByDict.html" class="code">ContainedByDict</a></td>
+ <td><span>Match a dictionary for which this is a super-dictionary.</span></td>
+ </tr><tr class="class">
+
+ <td>Class</td>
+ <td><a href="testtools.matchers.ContainsDict.html" class="code">ContainsDict</a></td>
+ <td><span>Match a dictionary for that contains a specified sub-dictionary.</span></td>
+ </tr><tr class="class">
+
+ <td>Class</td>
+ <td><a href="testtools.matchers.MatchesDict.html" class="code">MatchesDict</a></td>
+ <td><span>Match a dictionary exactly, by its keys.</span></td>
+ </tr><tr class="class">
+
+ <td>Class</td>
+ <td><a href="testtools.matchers.DirContains.html" class="code">DirContains</a></td>
+ <td><span>Matches if the given directory contains files with the given names.</span></td>
+ </tr><tr class="class">
+
+ <td>Class</td>
+ <td><a href="testtools.matchers.MatchesPredicate.html" class="code">MatchesPredicate</a></td>
+ <td><span>Match if a given function returns True.</span></td>
+ </tr><tr class="function">
+
+ <td>Function</td>
+ <td><a href="testtools.matchers.html#MatchesPredicateWithParams" class="code">MatchesPredicateWithParams</a></td>
+ <td><span>Match if a given parameterised function returns True.</span></td>
+ </tr>
+</table>
+
+
+
+ </div>
+
+ <div id="childList">
+
+ <div class="function">
+ <a name="testtools.matchers.MatchesPredicateWithParams">
+
+ </a>
+ <a name="MatchesPredicateWithParams">
+
+ </a>
+ <div class="functionHeader">
+
+ def
+ MatchesPredicateWithParams(predicate, message, name=None):
+
+ </div>
+ <div class="docstring functionBody">
+
+ <div><p>Match if a given parameterised function returns True.</p>
+<p>It is reasonably common to want to make a very simple matcher based on a
+function that you already have that returns True or False given some
+arguments. This matcher makes it very easy to do so. e.g.:</p>
+<pre class="rst-literal-block">
+HasLength = MatchesPredicate(
+ lambda x, y: len(x) == y, 'len({0}) is not {1}')
+# This assertion will fail, as 'len([1, 2]) == 3' is False.
+self.assertThat([1, 2], HasLength(3))
+</pre>
+<p>Note that unlike MatchesPredicate MatchesPredicateWithParams returns a
+factory which you then customise to use by constructing an actual matcher
+from it.</p>
+<p>The predicate function should take the object to match as its first
+parameter. Any additional parameters supplied when constructing a matcher
+are supplied to the predicate as additional parameters when checking for a
+match.</p><table class="fieldTable"><tr class="fieldStart"><td class="fieldName">Parameters</td><td class="fieldArg">predicate</td><td>The predicate function.</td></tr><tr><td></td><td class="fieldArg">message</td><td>A format string for describing mis-matches.</td></tr><tr><td></td><td class="fieldArg">name</td><td>Optional replacement name for the matcher.</td></tr></table></div>
+ </div>
+</div>
+
+ </div>
+ <address>
+ <a href="index.html">API Documentation</a> for <a href="https://github.com/testing-cabal/testtools">testtools</a>, generated by <a href="https://github.com/twisted/pydoctor/">pydoctor</a> at 2015-07-01 16:11:28.
+ </address>
+
+ </div>
+ </body>
+</html> \ No newline at end of file