Beispiel #1
0
    def test_validate_enforces_max_value(self):
        field = DecimalField(max_value=Decimal(5.4))

        expect(field.validate(5.3)).to_be_true()
        expect(field.validate(5.5)).to_be_false()
        expect(field.validate("5.2")).to_be_true()
Beispiel #2
0
    def test_validate_enforces_decimals(self):
        field = DecimalField()

        expect(field.validate(1.0)).to_be_true()
        expect(field.validate("1.5")).to_be_true()
        expect(field.validate("qwe")).to_be_false()