def test_value_contains_wildcard_false(): val = CPE.Value() val.from_wfn('"foo"') assert val.contains_wildcard() == False val.from_wfn('"foo\?"') assert val.contains_wildcard() == False val.from_wfn('"\*bar"') assert val.contains_wildcard() == False
def test_value_contains_wildcard_true(): val = CPE.Value() val.from_wfn('"?foo"') assert val.contains_wildcard() == True val.from_wfn('"??foo"') assert val.contains_wildcard() == True val.from_wfn('"*bar"') assert val.contains_wildcard() == True val.from_wfn('"foo?"') assert val.contains_wildcard() == True val.from_wfn('"foo??"') assert val.contains_wildcard() == True val.from_wfn('"bar*"') assert val.contains_wildcard() == True
def test_value_matches_false(): assert CPE.Value(fs='?foo').matches(CPE.Value(fs='fo')) == False assert CPE.Value(fs='?foo').matches(CPE.Value(fs='12foo')) == False assert CPE.Value(fs='?foo').matches(CPE.Value(fs='\?\?foo')) == False assert CPE.Value(fs='?foo').matches(CPE.Value(fs='foo1')) == False # double ? assert CPE.Value(fs='??foo').matches(CPE.Value(fs='fo')) == False assert CPE.Value(fs='??foo').matches(CPE.Value(fs='123foo')) == False assert CPE.Value(fs='??foo').matches(CPE.Value(fs='foo12')) == False assert CPE.Value(fs='*bar').matches(CPE.Value(fs='ba')) == False assert CPE.Value(fs='*bar').matches(CPE.Value(fs='blah\?ba')) == False assert CPE.Value(fs='foo?').matches(CPE.Value(fs='fo')) == False assert CPE.Value(fs='foo?').matches(CPE.Value(fs='foo12')) == False assert CPE.Value(fs='foo?').matches(CPE.Value(fs='foo\?\?')) == False # double ? assert CPE.Value(fs='foo??').matches(CPE.Value(fs='fo')) == False assert CPE.Value(fs='foo??').matches(CPE.Value(fs='foo123')) == False assert CPE.Value(fs='foo??').matches(CPE.Value(fs='\?foo')) == False assert CPE.Value(fs='foo??').matches(CPE.Value(fs='foo\?\?\?')) == False
def test_value_matches_true(): assert CPE.Value(fs='?foo').matches(CPE.Value(fs='foo')) == True # 0 match assert CPE.Value(fs='?foo').matches( CPE.Value(fs='1foo')) == True # full match assert CPE.Value(fs='?foo').matches( CPE.Value(fs='\?foo')) == True # quoted match # double ? assert CPE.Value(fs='??foo').matches( CPE.Value(fs='foo')) == True # 0 match assert CPE.Value(fs='??foo').matches( CPE.Value(fs='1foo')) == True # 0 full match assert CPE.Value(fs='??foo').matches( CPE.Value(fs='12foo')) == True # full match assert CPE.Value(fs='??foo').matches( CPE.Value(fs='\?foo')) == True # 0 full match assert CPE.Value(fs='??foo').matches( CPE.Value(fs='\?\?foo')) == True # full match assert CPE.Value(fs='*bar').matches(CPE.Value(fs='bar')) == True # 0 match assert CPE.Value(fs='*bar').matches( CPE.Value(fs='blahbar')) == True # full match assert CPE.Value(fs='*bar').matches( CPE.Value(fs='blah\?bar')) == True # full match + quoted assert CPE.Value(fs='foo?').matches(CPE.Value(fs='foo')) == True # 0 match assert CPE.Value(fs='foo?').matches( CPE.Value(fs='foo1')) == True # full match assert CPE.Value(fs='foo?').matches( CPE.Value(fs='foo\?')) == True # quoted match # double ? assert CPE.Value(fs='foo??').matches( CPE.Value(fs='foo')) == True # 0 match assert CPE.Value(fs='foo??').matches( CPE.Value(fs='foo1')) == True # 0 full match assert CPE.Value(fs='foo??').matches( CPE.Value(fs='foo12')) == True # full match assert CPE.Value(fs='foo??').matches( CPE.Value(fs='foo\?')) == True # 0 full match assert CPE.Value(fs='foo??').matches( CPE.Value(fs='foo\?\?')) == True # full match