fix for minimu and maximum in validators, added validator for choices and choices param for BaseField, include tests
This commit is contained in:
@ -28,6 +28,7 @@ class ExampleModel(Model):
|
||||
test_json: fields.JSON(default={})
|
||||
test_bigint: fields.BigInteger(default=0)
|
||||
test_decimal: fields.Decimal(scale=10, precision=2)
|
||||
test_decimal2: fields.Decimal(max_digits=10, decimal_places=2)
|
||||
|
||||
|
||||
fields_to_check = [
|
||||
@ -55,7 +56,7 @@ class ExampleModel2(Model):
|
||||
@pytest.fixture()
|
||||
def example():
|
||||
return ExampleModel(
|
||||
pk=1, test_string="test", test_bool=True, test_decimal=decimal.Decimal(3.5)
|
||||
pk=1, test_string="test", test_bool=True, test_decimal=decimal.Decimal(3.5), test_decimal2=decimal.Decimal(5.5)
|
||||
)
|
||||
|
||||
|
||||
@ -73,6 +74,8 @@ def test_model_attribute_access(example):
|
||||
assert example.test_float is None
|
||||
assert example.test_bigint == 0
|
||||
assert example.test_json == {}
|
||||
assert example.test_decimal == 3.5
|
||||
assert example.test_decimal2 == 5.5
|
||||
|
||||
example.test = 12
|
||||
assert example.test == 12
|
||||
|
||||
Reference in New Issue
Block a user