diff options
| author | Jacob Rief <jacob.rief@gmail.com> | 2023-04-08 22:10:17 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-06-16 08:38:28 +0200 |
| commit | 1fe0b167af3611cca79e8a8092ee929312193c6f (patch) | |
| tree | bfdc7ee5dd09b1f194b7308932b6de46c2881374 /tests/validators/tests.py | |
| parent | 549d6ffeb6d626b023acc40c3bb2093b4b25b3d6 (diff) | |
Fixed #34473 -- Fixed step validation for form fields with non-zero minimum value.
Diffstat (limited to 'tests/validators/tests.py')
| -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), ( |
