def test004_constructor_func(self): def custom_test_func(a, b, c): return a+b+c m = SinonMatcher(custom_test_func, is_custom_func=True) self.assertEqual(m.mtest(1,2,3), 6) m = SinonMatcher("(\w*) (\w*)", strcmp="regex") self.assertFalse(m.mtest("match"))
def test002_constructor_strcmp_string(self): m = SinonMatcher("match string", strcmp="default") self.assertTrue(m.mtest("match")) self.assertTrue(m.mtest("ch st")) self.assertTrue(m.mtest("match string")) self.assertFalse(m.mtest("match string++")) self.assertFalse(m.mtest("match strig"))
def test003_constructor_strcmp_regex(self): m = SinonMatcher("(\w*) (\w*)", strcmp="regex") self.assertFalse(m.mtest("match")) self.assertTrue(m.mtest("ch st")) self.assertTrue(m.mtest("match string")) self.assertTrue(m.mtest("match string++")) self.assertTrue(m.mtest("match strig"))
def test001_constructor_number(self): m = SinonMatcher(1) self.assertTrue(m.mtest(1)) self.assertFalse(m.mtest(2))