def test_compare_taxed_money_field_with_same_type_field(): field_1 = models.TaxedMoneyField( net_amount_field="price_net", gross_amount_field="price_gross", currency="currency", ) field_2 = models.TaxedMoneyField( net_amount_field="price_net", gross_amount_field="price_gross", currency="currency", ) # Comparision is based on creation_counter attribute assert field_1 < field_2 field_2.creation_counter -= 1 assert field_1 == field_2
def test_taxed_money_field_init(): field = models.TaxedMoneyField( net_amount_field="price_net", gross_amount_field="price_gross", currency="currency", ) assert field.net_amount_field == "price_net" assert field.gross_amount_field == "price_gross" assert field.currency == "currency"
def test_compare_money_field_with_taxed_money_field(): field_1 = models.MoneyField( amount_field="money_net_amount", currency_field="currency" ) field_2 = models.TaxedMoneyField(net_field="price_net", gross_field="price_gross") # Comparision is based on creation_counter attribute assert field_1 < field_2 assert not field_1 > field_2 field_2.creation_counter -= 1 assert field_1 == field_2
def test_compare_taxed_money_field_with_django_field(): field_1 = models.TaxedMoneyField( net_amount_field="price_net", gross_amount_field="price_gross", currency="currency", ) field_2 = DecimalField(default="5", max_digits=9, decimal_places=2) # Comparision is based on creation_counter attribute assert field_1 < field_2 assert not field_1 > field_2 field_2.creation_counter -= 1 assert field_1 == field_2