def test_dependency_matching4(self): # match the conj, but exclude because it contains an excluded deps = 'cc-conj-d,cc-conj-g' dep_pattern = 'cc-conj*' attributes = AttributeSet(dep_pattern, 'cc-conj-g', 1) self.assertEqual(False, ListMatching.is_match(deps, attributes, required=1))
def test_dependency_matching2(self): # Pattern looks for dependent, not governor deps = 'cc-conj-g' dep_pattern = 'cc-conj-d' attributes = AttributeSet(dep_pattern, '', 1) self.assertEqual(False, ListMatching.is_match(deps, attributes, required=1))
def test_dependency_matching3(self): # require 2 conj dependencies deps = 'cc-conj-d,cc-conj-g' dep_pattern = 'cc-conj*' attributes = AttributeSet(dep_pattern, '', 1) self.assertEqual(True, ListMatching.is_match(deps, attributes, required=2))
def test_dependency_matching1(self): # match anything starting with cc-conj deps = 'cc-conj-d' dep_pattern = 'cc-conj*' attributes = AttributeSet(dep_pattern, '', 1) self.assertEqual(True, ListMatching.is_match(deps, attributes, required=1))
def test_attr_list_fail7(self): # match the 3 required value = 'PNG,JPG,TIFF' attributes = AttributeSet('*G*', '', 1) self.assertEqual(False, ListMatching.is_match(value, attributes, required=3))
def test_attr_list_fail5(self): # check list of exclusions value = 'GBG' attributes = AttributeSet('*', 'A*,B*,G*', 1) self.assertEqual(False, ListMatching.is_match(value, attributes))
def test_attr_list_fail6(self): # doesn't match the 3 required value = 'PNG,JPG,TIFF' attributes = AttributeSet('*G*', '', 3) self.assertEqual(False, ListMatching.is_match(value, attributes))
def test_attr_list_fail3(self): # check that exclusions take precedence over matches value = 'AVG' attributes = AttributeSet('A*,*F', '*G', 1) self.assertEqual(False, ListMatching.is_match(value, attributes))
def test_attr_list_fail4(self): # check matching * but having a matching exclusion value = 'GBG' attributes = AttributeSet('*', 'G*', 1) self.assertEqual(False, ListMatching.is_match(value, attributes))
def test_attr_list_fail1(self): # exact match exclusion value = 'GHI' attributes = AttributeSet('ABC,DEF', 'GHI', 1) self.assertEqual(False, ListMatching.is_match(value, attributes))
def test_attr_list_fail2(self): # check an exclusion inside value = '1234 HI5' attributes = AttributeSet('ABC,DEF', '*HI*', 1) self.assertEqual(False, ListMatching.is_match(value, attributes))
def test_attr_list_pass5(self): # no restrictions on matching value = '123' attributes = AttributeSet('', '', 1) self.assertEqual(True, ListMatching.is_match(value, attributes))
def test_attr_list_pass4(self): # matches the 2 required value = 'PNG,JPG,TIFF' attributes = AttributeSet('*G*', '', 1) self.assertEqual(True, ListMatching.is_match(value, attributes, required=2))
def test_attr_list_pass3(self): value = 'AVG' attributes = AttributeSet('A*,*G', 'GHI', 2) self.assertEqual(True, ListMatching.is_match(value, attributes))
def test_attr_list_pass2(self): value = 'FHI' attributes = AttributeSet('*', 'G*', 1) self.assertEqual(True, ListMatching.is_match(value, attributes))
def test_attr_list_pass1(self): value = 'DEF' attributes = AttributeSet('ABC,DEF', 'GHI', 1) self.assertEqual(True, ListMatching.is_match(value, attributes))