diff --git a/rental_fees/tests/test_rental_fees_computation.py b/rental_fees/tests/test_rental_fees_computation.py index 53f57683f..89d044048 100644 --- a/rental_fees/tests/test_rental_fees_computation.py +++ b/rental_fees/tests/test_rental_fees_computation.py @@ -326,16 +326,22 @@ def months_from_start(date): delta = relativedelta(date, start_date) return delta.years * 12 + delta.months + def fees_descr(details): + mfs = months_from_start # just a short alias + aday = relativedelta(days=1) + return [(mfs(d.from_date), mfs(d.to_date + aday), d.fees) for d in details] + + forecast_fees = computation.detail_ids.filtered("is_forecast") + actual_fees = computation.detail_ids - forecast_fees + self.assertEqual( - [ - (months_from_start(d.from_date), months_from_start(d.to_date)) - for d in computation.detail_ids - ], - [(0, 2), (2, 3), (3, 5), (5, 39)], + fees_descr(actual_fees), + [(0, 1, 2.50), (1, 2, 2.50), (2, 3, 12.50), (3, 4, 12.50)], ) self.assertEqual( - [d.fees for d in computation.detail_ids], [0.0, 0.0, 45.0, 52.5] + fees_descr(forecast_fees), + [], ) self.assertEqual(