def test_condition_is_match_mixed_args(self):
     match_key = MatchKey('test %M %M', [], [(is_a, 'var1'), 'var2'])
     result = match_key.is_match('test a b')
     self.assertTrue(result[0])
     self.assertDictEqual(result[1], {'var1':'a', 'var2':'b'})
 def test_condition_false_no_match(self):
     match_key = MatchKey('test %M', [], [(is_a, 'var1')])
     result = match_key.is_match('test b')
     self.assertFalse(result[0])
     self.assertDictEqual(result[1], {})
 def test_condition_is_match(self):
     match_key = MatchKey('test %M', [], [(is_a, 'var1')])
     result = match_key.is_match('test a')
     self.assertTrue(result[0])
     self.assertDictEqual(result[1], {'var1':'a'})
 def test_is_match_wild_no_match_front(self):
     match_key = MatchKey('test %M', [], ['var1'])
     result = match_key.is_match('almost but')
     self.assertFalse(result[0])
     self.assertDictEqual(result[1], {})
 def test_is_match_wild_no_match_end(self):
     match_key = MatchKey('test %M nope', [], ['var1'])
     result = match_key.is_match('test yup almost')
     self.assertFalse(result[0])
     self.assertDictEqual(result[1], {})
 def test_is_match_partial_back_match(self):
     match_key = MatchKey('test this', [], [])
     result = match_key.is_match('nope this')
     self.assertFalse(result[0])
     self.assertDictEqual(result[1], {})
 def test_is_match_wilds_match(self):
     match_key = MatchKey('test %M %M', [], ['var1', 'var2'])
     result = match_key.is_match('test yup this')
     self.assertTrue(result[0])
     self.assertDictEqual(result[1], {'var1':'yup', 'var2':'this'})
 def test_condition_is_match_mixed_args(self):
     match_key = MatchKey('test %M %M', [], [(is_a, 'var1'), 'var2'])
     result = match_key.is_match('test a b')
     self.assertTrue(result[0])
     self.assertDictEqual(result[1], {'var1': 'a', 'var2': 'b'})
 def test_is_match_all_wrong(self):
     match_key = MatchKey('test this', [], [])
     result = match_key.is_match('nope na')
     self.assertFalse(result[0])
     self.assertDictEqual(result[1], {})
Exemple #10
0
 def test_condition_false_no_match(self):
     match_key = MatchKey('test %M', [], [(is_a, 'var1')])
     result = match_key.is_match('test b')
     self.assertFalse(result[0])
     self.assertDictEqual(result[1], {})
Exemple #11
0
 def test_condition_is_match(self):
     match_key = MatchKey('test %M', [], [(is_a, 'var1')])
     result = match_key.is_match('test a')
     self.assertTrue(result[0])
     self.assertDictEqual(result[1], {'var1': 'a'})
Exemple #12
0
 def test_is_match_wild_no_match_end(self):
     match_key = MatchKey('test %M nope', [], ['var1'])
     result = match_key.is_match('test yup almost')
     self.assertFalse(result[0])
     self.assertDictEqual(result[1], {})
Exemple #13
0
 def test_is_match_wild_no_match_front(self):
     match_key = MatchKey('test %M', [], ['var1'])
     result = match_key.is_match('almost but')
     self.assertFalse(result[0])
     self.assertDictEqual(result[1], {})
Exemple #14
0
 def test_is_match_wilds_match(self):
     match_key = MatchKey('test %M %M', [], ['var1', 'var2'])
     result = match_key.is_match('test yup this')
     self.assertTrue(result[0])
     self.assertDictEqual(result[1], {'var1': 'yup', 'var2': 'this'})
Exemple #15
0
 def test_is_match_partial_back_match(self):
     match_key = MatchKey('test this', [], [])
     result = match_key.is_match('nope this')
     self.assertFalse(result[0])
     self.assertDictEqual(result[1], {})
Exemple #16
0
 def test_is_match_all_wrong(self):
     match_key = MatchKey('test this', [], [])
     result = match_key.is_match('nope na')
     self.assertFalse(result[0])
     self.assertDictEqual(result[1], {})