openwebrx-clone/test/property/validators/test_regex_validator.py

14 lines
408 B
Python
Raw Normal View History

2021-01-24 21:03:53 +00:00
from unittest import TestCase
from owrx.property.validators import RegexValidator
import re
class RegexValidatorTest(TestCase):
def testMatchesRegex(self):
validator = RegexValidator(re.compile("abc"))
self.assertTrue(validator.isValid("abc"))
def testDoesntMatchRegex(self):
validator = RegexValidator(re.compile("abc"))
self.assertFalse(validator.isValid("xyz"))