[ENH] Add duration in Charge table - tests

This commit is contained in:
Mikado8231
2023-11-25 13:06:45 +01:00
committed by Florian BEZANNIER
parent 26df9f35a9
commit dfa4e8fb8d
2 changed files with 5 additions and 1 deletions
+3 -1
View File
@@ -33,7 +33,7 @@ from psa_car_controller.psacc.repository.trips import Trips
from psa_car_controller.psacc.utils.utils import get_temp
from tests.data.car_status import FUEL_CAR_STATUS, ELECTRIC_CAR_STATUS, ELECTRIC_CAR_STATUS_V2
from tests.utils import DATA_DIR, record_position, latitude, longitude, date0, date1, date2, date3, record_charging, \
vehicule_list, get_new_test_db, get_date, date4, compare_dict
vehicule_list, get_new_test_db, get_date, date4, compare_dict, duration_min, duration_str
from psa_car_controller.web.figures import get_figures, get_battery_curve_fig, get_altitude_fig
dummy_value = 0
@@ -237,6 +237,8 @@ class TestUnit(unittest.TestCase):
assert isinstance(co2, float)
assert compare_dict(chargings, [{'start_at': date0,
'stop_at': date3,
'duration_str': duration_str,
'duration_min' :duration_min,
'VIN': 'VR3UHZKX',
'start_level': 40,
'end_level': 85,
+2
View File
@@ -21,6 +21,8 @@ date2 = date3 - timedelta(minutes=20)
date1 = date3 - timedelta(minutes=40)
date0 = date3 - timedelta(minutes=60)
date4 = date3 + timedelta(minutes=1)
duration_min = (date3 - date0).seconds / 60
duration_str = str(date3 - date0)
vehicule_list = Cars()
vehicule_list.extend(