"""EV-20: T53, the acceptance sim day, Car first. `python3 -B test_ev20_long_car.py` The day and what is graded are in `tools/ev20_day.py`: the real Controller, N=2, 08:00-18:00 of sun with 12 clouds of 1 to 8 minutes, a house of 0.4 to 2.5 kW with three +3 kW steps; `step` over the day, `step_race` over three hours, a car-Off twin around the house steps. Batteries first is test_ev20_long.py. Mutating a module this file grades? Read MUTATION.md first (purge __pycache__). """ import logging import os import sys HERE = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, os.path.join(HERE, "tools")) import ev20_day # noqa: E402 fails = [] def check(name, cond): print(f" {'ok ' if cond else 'FAIL'} {name}") if not cond: fails.append(name) class _Log(logging.Handler): def __init__(self): super().__init__(logging.DEBUG) self.tb = [] def emit(self, r): if r.exc_info: self.tb.append(r.getMessage()) LOG = _Log() _g = logging.getLogger("goodwe") _g.addHandler(LOG) _g.setLevel(logging.DEBUG) _g.propagate = False print("T53: THE SIM DAY, CAR FIRST") ev20_day.run_day("car", check) check("T53: no Traceback", LOG.tb == []) print(f"\n{'all passed' if not fails else f'{len(fails)} FAILED'}") for f in fails: print(" FAIL:", f) sys.exit(1 if fails else 0)