mirror of
https://github.com/ha7ilm/openwebrx.git
synced 2026-04-04 22:17:34 +00:00
add regex validator
This commit is contained in:
parent
49577953c6
commit
a880b1f6f9
2 changed files with 22 additions and 0 deletions
13
test/property/validators/test_regex_validator.py
Normal file
13
test/property/validators/test_regex_validator.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
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"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue