mirror of
https://github.com/ha7ilm/openwebrx.git
synced 2026-04-04 14:07:32 +00:00
start implementing a validation layer, refs #215
This commit is contained in:
parent
8b52988dcd
commit
40e531c0da
8 changed files with 131 additions and 0 deletions
16
test/property/validators/test_validator.py
Normal file
16
test/property/validators/test_validator.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from unittest import TestCase
|
||||
from owrx.property.validators import Validator, NumberValidator, LambdaValidator
|
||||
|
||||
|
||||
class ValidatorTest(TestCase):
|
||||
|
||||
def testReturnsValidator(self):
|
||||
validator = NumberValidator()
|
||||
self.assertIs(validator, Validator.of(validator))
|
||||
|
||||
def testTransformsLambda(self):
|
||||
def my_callable(v):
|
||||
return True
|
||||
validator = Validator.of(my_callable)
|
||||
self.assertIsInstance(validator, LambdaValidator)
|
||||
self.assertTrue(validator.isValid("test"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue