summaryrefslogtreecommitdiff
path: root/lib/testtools/testtools/tests/matchers/test_higherorder.py
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-12-26 22:11:04 +0100
committerJelmer Vernooij <jelmer@samba.org>2012-12-27 19:23:03 +0100
commit983a3ea437d76b769b82726cc602d26e0e57894a (patch)
treece7bb9a0896fcbf53fe02c60e3199500f9e4833e /lib/testtools/testtools/tests/matchers/test_higherorder.py
parent24957527e0250a9a5d4c51ff47db9ff2eb11ee7b (diff)
downloadsamba-983a3ea437d76b769b82726cc602d26e0e57894a.tar.gz
testtools: Update to latest upstream version.
Diffstat (limited to 'lib/testtools/testtools/tests/matchers/test_higherorder.py')
-rw-r--r--lib/testtools/testtools/tests/matchers/test_higherorder.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/testtools/testtools/tests/matchers/test_higherorder.py b/lib/testtools/testtools/tests/matchers/test_higherorder.py
index 61f59824a13..c5cc44eb1d4 100644
--- a/lib/testtools/testtools/tests/matchers/test_higherorder.py
+++ b/lib/testtools/testtools/tests/matchers/test_higherorder.py
@@ -14,6 +14,7 @@ from testtools.matchers._higherorder import (
AllMatch,
Annotate,
AnnotatedMismatch,
+ AnyMatch,
MatchesAny,
MatchesAll,
MatchesPredicate,
@@ -50,6 +51,38 @@ class TestAllMatch(TestCase, TestMatchersInterface):
]
+class TestAnyMatch(TestCase, TestMatchersInterface):
+
+ matches_matcher = AnyMatch(Equals('elephant'))
+ matches_matches = [
+ ['grass', 'cow', 'steak', 'milk', 'elephant'],
+ (13, 'elephant'),
+ ['elephant', 'elephant', 'elephant'],
+ set(['hippo', 'rhino', 'elephant']),
+ ]
+ matches_mismatches = [
+ [],
+ ['grass', 'cow', 'steak', 'milk'],
+ (13, 12, 10),
+ ['element', 'hephalump', 'pachyderm'],
+ set(['hippo', 'rhino', 'diplodocus']),
+ ]
+
+ str_examples = [
+ ("AnyMatch(Equals('elephant'))", AnyMatch(Equals('elephant'))),
+ ]
+
+ describe_examples = [
+ ('Differences: [\n'
+ '7 != 11\n'
+ '7 != 9\n'
+ '7 != 10\n'
+ ']',
+ [11, 9, 10],
+ AnyMatch(Equals(7))),
+ ]
+
+
class TestAfterPreprocessing(TestCase, TestMatchersInterface):
def parity(x):