コード例 #1
0
ファイル: test_fields.py プロジェクト: marcosschroh/faust
 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
コード例 #2
0
ファイル: test_fields.py プロジェクト: marcosschroh/faust
 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))
コード例 #3
0
ファイル: test_fields.py プロジェクト: marcosschroh/faust
 def test_infinite(self, value):
     f = DecimalField(coerce=True, field='foo')
     with pytest.raises(ValidationError):
         raise next(f.validate(value))
コード例 #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))