def test_money_field_from_db_value_checks_currency(): field = MoneyField('price', currency='BTC', default='5', max_digits=9, decimal_places=2) invalid = Money(1, 'USD') with pytest.raises(ValueError): field.from_db_value(invalid, None, None, None)
def test_money_field_from_db_value_handles_none(): field = MoneyField('price', currency='BTC', default='5', max_digits=9, decimal_places=2) assert field.from_db_value(None, None, None, None) is None
def test_money_field_from_db_value_checks_min_value(): field = MoneyField( 'price', currency='BTC', default='5', max_digits=9, decimal_places=2) invalid = Money(1, 'USD') with pytest.raises(ValueError): field.from_db_value(invalid, None, None, None)
def test_money_field_from_db_value_handles_none(): field = MoneyField( 'price', currency='BTC', default='5', max_digits=9, decimal_places=2) assert field.from_db_value(None, None, None, None) is None