start implementing a validation layer, refs #215

This commit is contained in:
Jakob Ketterl
2021-01-24 20:53:51 +01:00
parent 8b52988dcd
commit 40e531c0da
8 changed files with 131 additions and 0 deletions

View File

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