示例#1
0
def test_from_db_value_checks_currency():
    field = PriceField('price',
                       currency='BTC',
                       default='5',
                       max_digits=9,
                       decimal_places=2)
    invalid = Price(1, currency='USD')
    with pytest.raises(ValueError):
        field.from_db_value(invalid, None, None, None)
示例#2
0
def test_from_db_value_handles_none():
    field = PriceField('price',
                       currency='BTC',
                       default='5',
                       max_digits=9,
                       decimal_places=2)
    assert field.from_db_value(None, None, None, None) is None