summaryrefslogtreecommitdiff
path: root/lib/subunit/python/testtools/tests/test_matchers.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/subunit/python/testtools/tests/test_matchers.py')
-rw-r--r--lib/subunit/python/testtools/tests/test_matchers.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/subunit/python/testtools/tests/test_matchers.py b/lib/subunit/python/testtools/tests/test_matchers.py
index a9f4b245eb..d5fd8bab3b 100644
--- a/lib/subunit/python/testtools/tests/test_matchers.py
+++ b/lib/subunit/python/testtools/tests/test_matchers.py
@@ -12,6 +12,9 @@ from testtools.matchers import (
Equals,
DocTestMatches,
MatchesAny,
+ MatchesAll,
+ Not,
+ NotEquals,
)
@@ -81,6 +84,31 @@ class TestEqualsInterface(TestCase, TestMatchersInterface):
describe_examples = [("1 != 2", 2, Equals(1))]
+class TestNotEqualsInterface(TestCase, TestMatchersInterface):
+
+ matches_matcher = NotEquals(1)
+ matches_matches = [2]
+ matches_mismatches = [1]
+
+ str_examples = [
+ ("NotEquals(1)", NotEquals(1)), ("NotEquals('1')", NotEquals('1'))]
+
+ describe_examples = [("1 == 1", 1, NotEquals(1))]
+
+
+class TestNotInterface(TestCase, TestMatchersInterface):
+
+ matches_matcher = Not(Equals(1))
+ matches_matches = [2]
+ matches_mismatches = [1]
+
+ str_examples = [
+ ("Not(Equals(1))", Not(Equals(1))),
+ ("Not(Equals('1'))", Not(Equals('1')))]
+
+ describe_examples = [('1 matches Equals(1)', 1, Not(Equals(1)))]
+
+
class TestMatchersAnyInterface(TestCase, TestMatchersInterface):
matches_matcher = MatchesAny(DocTestMatches("1"), DocTestMatches("2"))
@@ -108,6 +136,23 @@ Got:
"3", MatchesAny(DocTestMatches("1"), DocTestMatches("2")))]
+class TestMatchesAllInterface(TestCase, TestMatchersInterface):
+
+ matches_matcher = MatchesAll(NotEquals(1), NotEquals(2))
+ matches_matches = [3, 4]
+ matches_mismatches = [1, 2]
+
+ str_examples = [
+ ("MatchesAll(NotEquals(1), NotEquals(2))",
+ MatchesAll(NotEquals(1), NotEquals(2)))]
+
+ describe_examples = [("""Differences: [
+1 == 1
+]
+""",
+ 1, MatchesAll(NotEquals(1), NotEquals(2)))]
+
+
def test_suite():
from unittest import TestLoader
return TestLoader().loadTestsFromName(__name__)