remove unused code
This commit is contained in:
parent
b52af85987
commit
a7a37d4614
2 changed files with 1 additions and 45 deletions
|
|
@ -4,11 +4,7 @@ import pytest
|
||||||
from money.currency import Currency
|
from money.currency import Currency
|
||||||
|
|
||||||
from xexe.currency_pair import CurrencyPair
|
from xexe.currency_pair import CurrencyPair
|
||||||
from xexe.utils import (
|
from xexe.utils import DateRange, generate_pairs_and_dates_combinations
|
||||||
DateRange,
|
|
||||||
generate_currency_and_dates_combinations,
|
|
||||||
generate_pairs_and_dates_combinations,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_date_range_breaks_with_reversed_dates():
|
def test_date_range_breaks_with_reversed_dates():
|
||||||
|
|
@ -35,25 +31,6 @@ def test_date_range_generates_proper_dates_when_itered():
|
||||||
assert len(dates) == 3
|
assert len(dates) == 3
|
||||||
|
|
||||||
|
|
||||||
def test_generate_currency_and_dates_combinations_outputs_correctly():
|
|
||||||
|
|
||||||
date_range = DateRange(
|
|
||||||
start_date=datetime.date(year=2024, month=1, day=1),
|
|
||||||
end_date=datetime.date(year=2024, month=1, day=3),
|
|
||||||
)
|
|
||||||
|
|
||||||
currencies = {Currency.USD, Currency.EUR, Currency.GBP}
|
|
||||||
|
|
||||||
combinations = generate_currency_and_dates_combinations(
|
|
||||||
currencies=currencies, date_range=date_range
|
|
||||||
)
|
|
||||||
|
|
||||||
assert len(combinations) == 9
|
|
||||||
assert len({combination["date"] for combination in combinations}) == 3
|
|
||||||
assert len({combination["from_currency"] for combination in combinations}) == 2
|
|
||||||
assert len({combination["to_currency"] for combination in combinations}) == 2
|
|
||||||
|
|
||||||
|
|
||||||
def test_generate_pair_and_dates_combinations_outputs_correctly():
|
def test_generate_pair_and_dates_combinations_outputs_correctly():
|
||||||
date_range = DateRange(
|
date_range = DateRange(
|
||||||
start_date=datetime.date(year=2024, month=1, day=1),
|
start_date=datetime.date(year=2024, month=1, day=1),
|
||||||
|
|
|
||||||
|
|
@ -69,27 +69,6 @@ class DateRange:
|
||||||
current_date += datetime.timedelta(days=1)
|
current_date += datetime.timedelta(days=1)
|
||||||
|
|
||||||
|
|
||||||
def generate_currency_and_dates_combinations(
|
|
||||||
date_range: DateRange, currencies: Set[Currency]
|
|
||||||
) -> Tuple[dict]:
|
|
||||||
currency_pairs = list(combinations(currencies, 2))
|
|
||||||
|
|
||||||
currency_date_combinations = []
|
|
||||||
for date in date_range:
|
|
||||||
for from_currency, to_currency in currency_pairs:
|
|
||||||
currency_date_combinations.append(
|
|
||||||
{
|
|
||||||
"from_currency": from_currency,
|
|
||||||
"to_currency": to_currency,
|
|
||||||
"date": date,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
currency_date_combinations = tuple(currency_date_combinations)
|
|
||||||
|
|
||||||
return currency_date_combinations
|
|
||||||
|
|
||||||
|
|
||||||
def generate_pairs_and_dates_combinations(
|
def generate_pairs_and_dates_combinations(
|
||||||
date_range: DateRange, pairs: Set[CurrencyPair]
|
date_range: DateRange, pairs: Set[CurrencyPair]
|
||||||
) -> Tuple[dict]:
|
) -> Tuple[dict]:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue