summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'test.py')
-rwxr-xr-xtest.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/test.py b/test.py
index 3d27d54..a37977b 100755
--- a/test.py
+++ b/test.py
@@ -23,8 +23,8 @@ from mocker import \
PathMatcher, path_matcher_recorder, RunCounter, ImplicitRunCounter, \
run_counter_recorder, run_counter_removal_recorder, MockReturner, \
mock_returner_recorder, FunctionRunner, Orderer, SpecChecker, \
- spec_checker_recorder, match_params, ANY, IS, CONTAINS, IN, ARGS, KWARGS, \
- MatchError, PathExecuter, ProxyReplacer, Patcher, Undefined, \
+ spec_checker_recorder, match_params, ANY, IS, CONTAINS, IN, MATCH, ARGS, \
+ KWARGS, MatchError, PathExecuter, ProxyReplacer, Patcher, Undefined, \
PatchedMethod, MockerTestCase, ReplayRestoreEvent, OnRestoreCaller
@@ -2089,6 +2089,18 @@ class MatchParamsTest(TestCase):
self.assertFalse(IN([1]).matches([1]))
self.assertFalse(IN([1]).matches(object()))
+ def test_match_repr(self):
+ self.assertEquals(repr(MATCH("obj")), "MATCH('obj')")
+
+ def test_match_equals(self):
+ obj1, obj2 = [], []
+ self.assertEquals(MATCH(obj1), MATCH(obj1))
+ self.assertNotEquals(MATCH(obj1), MATCH(obj2))
+
+ def test_match_matches(self):
+ self.assertTrue(MATCH(lambda x: x > 10).matches(15))
+ self.assertFalse(MATCH(lambda x: x > 10).matches(5))
+
def test_normal(self):
self.true((), {}, (), {})
self.true((1, 2), {"a": 3}, (1, 2), {"a": 3})