"""Tests for the M5 system inventory (render + dict round-trip; collect on real system).""" import unittest from rigdoctor.core import inventory from rigdoctor.core.inventory import Section class InventoryTests(unittest.TestCase): def test_collect_returns_sections(self): sections = inventory.collect() self.assertTrue(sections) titles = {s.title for s in sections} self.assertIn("System", titles) self.assertIn("CPU", titles) def test_dict_round_trip(self): sections = [Section("System", [("Kernel", "7.0.0"), ("Distro", "Ubuntu")])] restored = inventory.from_dict(inventory.to_dict(sections)) self.assertEqual(restored[0].title, "System") self.assertEqual(restored[0].items, [("Kernel", "7.0.0"), ("Distro", "Ubuntu")]) def test_render_markdown(self): md = inventory.render_markdown([Section("CPU", [("Model", "Test CPU")])]) self.assertIn("## CPU", md) self.assertIn("- **Model:** Test CPU", md) if __name__ == "__main__": unittest.main()