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
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))
def test_infinite(self, value): f = DecimalField(coerce=True, field='foo') with pytest.raises(ValidationError): raise next(f.validate(value))
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))