From 9280e048dd5a6a61fc1bb88dda21098a84d6fc09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Sch=C3=A4fer?= Date: Tue, 7 Nov 2023 11:39:23 -0500 Subject: [PATCH] power draw test: improve verbosity (#30402) * improve verbosity * unused import old-commit-hash: 11855eab5df1409639fb9e94fcf0afa725164b97 --- system/hardware/tici/tests/test_power_draw.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/hardware/tici/tests/test_power_draw.py b/system/hardware/tici/tests/test_power_draw.py index 659ed16e2..641193574 100755 --- a/system/hardware/tici/tests/test_power_draw.py +++ b/system/hardware/tici/tests/test_power_draw.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 import unittest import time -import math import threading +import numpy as np from dataclasses import dataclass from tabulate import tabulate from typing import List @@ -94,8 +94,8 @@ class TestPowerDraw(unittest.TestCase): msgs_expected = int(sum(SAMPLE_TIME * SERVICE_LIST[msg].frequency for msg in proc.msgs)) tab.append([proc.name, round(expected, 2), round(cur, 2), msgs_expected, msgs_received]) with self.subTest(proc=proc.name): - self.assertTrue(math.isclose(cur, expected, rel_tol=proc.rtol, abs_tol=proc.atol)) - self.assertTrue(math.isclose(msgs_expected, msgs_received, rel_tol=.02, abs_tol=2)) + np.testing.assert_allclose(cur, expected, rtol=proc.rtol, atol=proc.atol) + np.testing.assert_allclose(msgs_expected, msgs_received, rtol=.02, atol=2) print(tabulate(tab)) print(f"Baseline {baseline:.2f}W\n")