Esempio n. 1
0
 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'})
Esempio n. 2
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], {})
Esempio n. 3
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'})
Esempio n. 4
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], {})
Esempio n. 5
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], {})
Esempio n. 6
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], {})
Esempio n. 7
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'})
Esempio n. 8
0
 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'})
Esempio n. 9
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], {})
Esempio n. 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], {})
Esempio n. 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'})
Esempio n. 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], {})
Esempio n. 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], {})
Esempio n. 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'})
Esempio n. 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], {})
Esempio n. 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], {})