diff options
-rw-r--r-- | tests/test_regexopt.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_regexopt.py b/tests/test_regexopt.py index f62a57ef..66f7c609 100644 --- a/tests/test_regexopt.py +++ b/tests/test_regexopt.py @@ -50,3 +50,19 @@ class RegexOptTestCase(unittest.TestCase): self.assertTrue(rex.match(w)) for w in no_match: self.assertFalse(rex.match(w)) + + def test_prefix(self): + opt = regex_opt(('a', 'b'), prefix=r':{1,2}') + print(opt) + rex = re.compile(opt) + self.assertFalse(rex.match('a')) + self.assertTrue(rex.match('::a')) + self.assertFalse(rex.match(':::')) # fullmatch + + def test_suffix(self): + opt = regex_opt(('a', 'b'), suffix=r':{1,2}') + print(opt) + rex = re.compile(opt) + self.assertFalse(rex.match('a')) + self.assertTrue(rex.match('a::')) + self.assertFalse(rex.match(':::')) # fullmatch |