Files
2026-07-21 19:25:17 +02:00

25 lines
932 B
Python

"""
Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors.
This file is part of sunnypilot and is licensed under the MIT License.
See the LICENSE.md file in the root directory for more details.
"""
import hashlib
from openpilot.sunnypilot.models.default_model import MODEL_HASH_PATH, OFF_POLICY_ONNX_PATH, ON_POLICY_ONNX_PATH, \
VISION_ONNX_PATH, get_model_hash
class TestDefaultModel:
def test_compare_onnx_hashes(self):
vision_hash = get_model_hash(VISION_ONNX_PATH)
on_policy_hash = get_model_hash(ON_POLICY_ONNX_PATH)
off_policy_hash = get_model_hash(OFF_POLICY_ONNX_PATH)
combined_hash = hashlib.sha256((vision_hash + on_policy_hash + off_policy_hash).encode()).hexdigest()
with open(MODEL_HASH_PATH) as f:
current_hash = f.read().strip()
assert combined_hash == current_hash, "Run sunnypilot/models/default_model.py to update the default model name and hash"