def test_patterns(self):
     self.assertEqual(MatchValue("x", "abc")._pattern, "abc", "equals matches")
     self.assertEqual(MatchValue("x", "abc*")._pattern, "abc", "startswith matches")
     self.assertEqual(MatchValue("x", "*abc")._pattern, "abc", "endswith matches")
     self.assertEqual(MatchValue("x", "*abc*")._pattern, "abc", "contains matches")
     self.assertEqual(MatchValue("x", "a*bc")._pattern, "a*bc", "2 equals matches")
     self.assertEqual(MatchValue("x", "a*bc*")._pattern, "a*bc", "2 startswith matches")
     self.assertEqual(MatchValue("x", "*a*bc")._pattern, "a*bc", "2 endswith matches")
     self.assertEqual(MatchValue("x", "*a*bc*")._pattern, "a*bc", "2 contains matches")
 def DEPRICATED_test_patterns_for_rex(self):
     self.assertEqual(MatchValue("x", "abc")._pattern, "^abc$", "equals matches")
     self.assertEqual(MatchValue("x", "abc*")._pattern, "^abc", "startswith matches")
     self.assertEqual(MatchValue("x", "*abc")._pattern, "abc$", "endswith matches")
     self.assertEqual(MatchValue("x", "*abc*")._pattern, "abc", "contains matches")
     self.assertEqual(MatchValue("x", "a*bc")._pattern, "^a*bc$", "2 equals matches")
     self.assertEqual(MatchValue("x", "a*bc*")._pattern, "^a*bc", "2 startswith matches")
     self.assertEqual(MatchValue("x", "*a*bc")._pattern, "a*bc$", "2 endswith matches")
     self.assertEqual(MatchValue("x", "*a*bc*")._pattern, "a*bc", "2 contains matches")
    def test_match_value_contains(self):
        v = MatchValue("col-a", "*abc*")
        test_str = "abc"
        self.assertTrue(v.match_value(test_str)[0], "test string match for " + test_str)
        test_str = "--=--=--.*abc=--=----"
        self.assertTrue(v.match_value(test_str)[0], "test string match for " + test_str)
        test_str = "----abc-----"
        self.assertTrue(v.match_value(test_str)[0], "test string match for " + test_str)
        test_str = "--[abc]+"
        self.assertTrue(v.match_value(test_str)[0], "test string match for " + test_str)

        test_str = "bc"
        self.assertFalse(v.match_value(test_str)[0], "test string match for " + test_str)
        test_str = ".bc"
        self.assertFalse(v.match_value(test_str)[0], "test string match for " + test_str)
        test_str = "..c"
        self.assertFalse(v.match_value(test_str)[0], "test string match for " + test_str)
 def test_match_value_any(self):
     v = MatchValue("col-a", "*")
     test_str = "abc"
     self.assertTrue(v.match_value(test_str)[0], "test string match for " + test_str)
     test_str = "--=--=--.*abc"
     self.assertTrue(v.match_value(test_str)[0], "test string match for " + test_str)
     test_str = "----abc-----"
     self.assertTrue(v.match_value(test_str)[0], "test string match for " + test_str)
     test_str = "--[abc]+"
     self.assertTrue(v.match_value(test_str)[0], "test string match for " + test_str)
 def test_match_value_startswith(self):
     v = MatchValue("col-a", "abc*")
     test_str = "abc"
     self.assertTrue(v.match_value(test_str)[0], "test string match for " + test_str)
     test_str = "abc--"
     self.assertTrue(v.match_value(test_str)[0], "test string match for " + test_str)
     test_str = "--abc"
     self.assertFalse(v.match_value(test_str)[0], "test string match for " + test_str)
     test_str = "--abc--"
     self.assertFalse(v.match_value(test_str)[0], "test string match for " + test_str)
 def test_match_value_equals(self):
     v = MatchValue("col-a", "abc")
     self.assertEqual(v._key, "col-a", "Key is set correctly")
     test_str = "abc"
     self.assertTrue(v.match_value(test_str)[0], "test string match for " + test_str)
     test_str = "abc--"
     self.assertFalse(v.match_value(test_str)[0], "test string match for " + test_str)
     test_str = "--abc"
     self.assertFalse(v.match_value(test_str)[0], "test string match for " + test_str)
     test_str = "--abc--"
     self.assertFalse(v.match_value(test_str)[0], "test string match for " + test_str)