add more validators

This commit is contained in:
Jakob Ketterl
2021-01-24 21:58:02 +01:00
parent 66dc4e5772
commit 4b03ced1f7
4 changed files with 90 additions and 7 deletions

View File

@ -0,0 +1,15 @@
from unittest import TestCase
from owrx.property.validators import FloatValidator
class FloatValidatorTest(TestCase):
def testPassesNumbers(self):
validator = FloatValidator()
self.assertTrue(validator.isValid(.5))
def testDoesntPassOthers(self):
validator = FloatValidator()
self.assertFalse(validator.isValid(123))
self.assertFalse(validator.isValid(-2))
self.assertFalse(validator.isValid("text"))
self.assertFalse(validator.isValid(object()))