From 3a7f9173c7dac32fc0dd0facfa7fd6de21ac6ac8 Mon Sep 17 00:00:00 2001 From: Saeed Ranjbar Date: Tue, 10 Oct 2023 14:05:53 -0400 Subject: [PATCH] completed test_systems_catalog.py --- tests/test_systems_catalog.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/test_systems_catalog.py b/tests/test_systems_catalog.py index f24808f3..eee75069 100644 --- a/tests/test_systems_catalog.py +++ b/tests/test_systems_catalog.py @@ -40,4 +40,24 @@ class TestSystemsCatalog(TestCase): def test_north_america_systems_catalog(self): catalog = EnergySystemsCatalogFactory('north_america').catalog + catalog_categories = catalog.names() + archetypes = catalog.names('archetypes') + self.assertEqual(6, len(archetypes['archetypes'])) + systems = catalog.names('systems') + self.assertEqual(7, len(systems['systems'])) + generation_equipments = catalog.names('generation_equipments') + self.assertEqual(21, len(generation_equipments['generation_equipments'])) + storage_equipments = catalog.names('storage_equipments') + self.assertEqual(6, len(storage_equipments['storage_equipments'])) + with self.assertRaises(ValueError): + catalog.names('unknown') + + # retrieving all the entries should not raise any exceptions + for category in catalog_categories: + for value in catalog_categories[category]: + catalog.get_entry(value) + print(catalog.entries()) + + with self.assertRaises(IndexError): + catalog.get_entry('unknown')