implement equality
This commit is contained in:
parent
132d51777a
commit
7cfbe2284d
2 changed files with 20 additions and 4 deletions
|
|
@ -20,7 +20,7 @@ def test_create_currency_pair_with_same_currency_works():
|
|||
assert (same_curr_pair.from_currency == "USD", same_curr_pair.to_currency == "USD")
|
||||
|
||||
|
||||
def test_reverse_currency_works_fine():
|
||||
def test_reverse_pair_works_fine():
|
||||
|
||||
a_pair: CurrencyPair = CurrencyPair(
|
||||
from_currency=Currency["USD"], to_currency=Currency["EUR"]
|
||||
|
|
@ -33,3 +33,14 @@ def test_reverse_currency_works_fine():
|
|||
reverse_pair.from_currency == "EUR",
|
||||
reverse_pair.to_currency == "USD",
|
||||
)
|
||||
|
||||
|
||||
def test_pair_equality_works():
|
||||
|
||||
a_pair: CurrencyPair = CurrencyPair(
|
||||
from_currency=Currency["USD"], to_currency=Currency["EUR"]
|
||||
)
|
||||
|
||||
reverse_pair: CurrencyPair = a_pair.get_reverse_pair()
|
||||
|
||||
assert a_pair == a_pair and a_pair != reverse_pair
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue