diff options
Diffstat (limited to 'tests/validators')
| -rw-r--r-- | tests/validators/tests.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/validators/tests.py b/tests/validators/tests.py index 02bee30ac1..af08a785fe 100644 --- a/tests/validators/tests.py +++ b/tests/validators/tests.py @@ -451,11 +451,39 @@ TEST_DATA = [ (StepValueValidator(3), 1, ValidationError), (StepValueValidator(3), 8, ValidationError), (StepValueValidator(3), 9, None), + (StepValueValidator(2), 4, None), + (StepValueValidator(2, offset=1), 3, None), + (StepValueValidator(2, offset=1), 4, ValidationError), (StepValueValidator(0.001), 0.55, None), (StepValueValidator(0.001), 0.5555, ValidationError), + (StepValueValidator(0.001, offset=0.0005), 0.5555, None), + (StepValueValidator(0.001, offset=0.0005), 0.555, ValidationError), (StepValueValidator(Decimal(0.02)), 0.88, None), (StepValueValidator(Decimal(0.02)), Decimal(0.88), None), (StepValueValidator(Decimal(0.02)), Decimal(0.77), ValidationError), + (StepValueValidator(Decimal(0.02), offset=Decimal(0.01)), Decimal(0.77), None), + (StepValueValidator(Decimal(2.0), offset=Decimal(0.1)), Decimal(0.1), None), + ( + StepValueValidator(Decimal(0.02), offset=Decimal(0.01)), + Decimal(0.88), + ValidationError, + ), + (StepValueValidator(Decimal("1.2"), offset=Decimal("2.2")), Decimal("3.4"), None), + ( + StepValueValidator(Decimal("1.2"), offset=Decimal("2.2")), + Decimal("1.2"), + ValidationError, + ), + ( + StepValueValidator(Decimal("-1.2"), offset=Decimal("2.2")), + Decimal("1.1"), + ValidationError, + ), + ( + StepValueValidator(Decimal("-1.2"), offset=Decimal("2.2")), + Decimal("1.0"), + None, + ), (URLValidator(EXTENDED_SCHEMES), "file://localhost/path", None), (URLValidator(EXTENDED_SCHEMES), "git://example.com/", None), ( |
