def test_value_mismatch(self): val = va.is_money() model = MyModel() model.prop = 'sdfads' valid, error = val(model, 'prop') assert not valid assert error == (msg.INVALID_VALUE,)
def test_none(self): val = va.is_money() model = MyModel() model.prop = None valid, error = val(model, 'prop') assert valid assert error is None
def test_not_allow_zero(self): val = va.is_money(allow_zero=False) model = MyModel() model.prop = Decimal('0.0') valid, error = val(model, 'prop') assert not valid assert error == (msg.NOT_ZERO,)
def test_negative(self): val = va.is_money() model = MyModel() model.prop = Decimal('-12.33') valid, error = val(model, 'prop') assert not valid assert error == (msg.POSITIVE_VALUE,)
def test_is_money(self): val = va.is_money() model = MyModel() model.prop = Decimal('12.33') valid, error = val(model, 'prop') assert valid assert error is None