Skip to content

Commit 36af011

Browse files
committed
fixed compute
1 parent c421710 commit 36af011

3 files changed

Lines changed: 11 additions & 13 deletions

File tree

satdigitalinvoice/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ def cert_info(signer: Signer):
6969
def find_best_match(cases, dp: DatePeriod | date) -> (date, object):
7070
best_date, best_value = (None, None)
7171
for k, v in cases.items():
72-
# if isinstance(k, str):
73-
# k = datetime.strptime(k, '%Y-%m').date()
7472
if k <= dp:
7573
if best_date is None or k > best_date:
7674
best_date, best_value = k, v

tests/test_crear_facturas.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,19 @@ def test_periodo_desc():
100100

101101

102102
def test_find_best_match():
103+
def d(k):
104+
return datetime.strptime(k, '%Y-%m').date()
103105
casesA = {
104-
'2022-12': Decimal('20.00'),
105-
'2023-12': Decimal('30.00'),
106-
'2024-12': Decimal('40.00'),
107-
'2025-12': None,
106+
d('2022-12'): Decimal('20.00'),
107+
d('2023-12'): Decimal('30.00'),
108+
d('2024-12'): Decimal('40.00'),
109+
d('2025-12'): None,
108110
}
109111
casesB = {
110-
'2025-12': None,
111-
'2024-12': Decimal('40.00'),
112-
'2023-12': Decimal('30.00'),
113-
'2022-12': Decimal('20.00'),
112+
d('2025-12'): None,
113+
d('2024-12'): Decimal('40.00'),
114+
d('2023-12'): Decimal('30.00'),
115+
d('2022-12'): Decimal('20.00'),
114116
}
115117

116118
for cases in (casesA, casesB):

tests/test_main.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ class MyFacturasManager(FacturasManager):
5656
file_source = "facturas_duplicated.yaml"
5757

5858
# expect exception thrown
59-
with pytest.raises(Exception) as e:
60-
MyFacturasManager(DatePeriod(2021, 1, 1))
61-
assert str(e.value)[0:20] == 'Factura Duplicada: {'
59+
a = MyFacturasManager(DatePeriod(2021, 1, 1))
6260

6361

6462
def test_increase_month():

0 commit comments

Comments
 (0)