Exemple #1
0
 def test_max_decimal_places__good(self, value, places, digits):
     f = DecimalField(
         max_decimal_places=places,
         max_digits=digits,
         coerce=True,
         field='foo',
     )
     d: Decimal = f.prepare_value(value)
     for error in f.validate(d):
         raise error
Exemple #2
0
 def test_max_digits__bad(self, value):
     f = DecimalField(max_digits=4, coerce=True, field='foo')
     with pytest.raises(ValidationError):
         raise next(f.validate(value))
Exemple #3
0
 def test_infinite(self, value):
     f = DecimalField(coerce=True, field='foo')
     with pytest.raises(ValidationError):
         raise next(f.validate(value))
Exemple #4
0
 def test_max_decimal_places__bad(self, value):
     f = DecimalField(max_decimal_places=4, coerce=True, field="foo")
     with pytest.raises(ValidationError):
         raise next(f.validate(value))