aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_stats.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-10 18:20:15 +0100
committerDanilo M. <danix@danix.xyz>2026-11-10 18:20:15 +0100
commit624a7a845c601990f5550a3cb3db38b139feb5da (patch)
treeeeadd266f1cfca2dbcbac4ad4743c61e17f84d86 /tests/test_stats.py
parentb22003b6a86f16f3de6f77093fb94d8b89203dc2 (diff)
downloaddeck-it-624a7a845c601990f5550a3cb3db38b139feb5da.tar.gz
deck-it-624a7a845c601990f5550a3cb3db38b139feb5da.zip
feat(stats): processor and card names, both network rates large
The CPU tile is labelled with /proc/cpuinfo's model name, trimmed of core counts and trademarks; the GPU tile with lspci's marketing name for the xe card. The network tile shows download and upload side by side at the same size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_stats.py')
-rw-r--r--tests/test_stats.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_stats.py b/tests/test_stats.py
index 1a28ae8..f32bfac 100644
--- a/tests/test_stats.py
+++ b/tests/test_stats.py
@@ -37,6 +37,22 @@ class Stats(unittest.TestCase):
self.assertIn("stats", names)
+class Names(unittest.TestCase):
+ def test_cpu_name(self):
+ self.assertEqual(stats._cpu_name("model name\t: AMD Ryzen 7 9700X 8-Core Processor\n"),
+ "AMD Ryzen 7 9700X")
+ self.assertEqual(stats._cpu_name("model name : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz"),
+ "Intel Core i7-8550U")
+ self.assertIsNone(stats._cpu_name(""))
+
+ def test_gpu_name(self):
+ line = ('03:00.0 "VGA compatible controller" "Intel Corporation" '
+ '"Battlemage G21 [Arc B580]" -p00 "Vendor" "Device 4215"')
+ self.assertEqual(stats._gpu_name(line), "Intel Arc B580")
+ self.assertEqual(stats._gpu_name('03:00.0 "VGA" "Intel Corporation" "DG2"'), "Intel DG2")
+ self.assertIsNone(stats._gpu_name(""))
+
+
class Intel(unittest.TestCase):
def test_parse_bytes(self):
self.assertEqual(stats._parse_bytes("12G"), 12 * 1024 ** 3)