class TestBuildingClass(unittest.TestCase): """Class used to test builing is populated and allocates rooms.""" def setUp(self): self.build = Building("input.txt") self.build.allocate_to_office() def test_building_is_populated_with_data(self): self.assertIsNone(self.build.populate_rooms(), msg="room_directory should be poplated with data from list.") self.assertIsNone(self.build.get_fellows(), msg="data from returned parser class should be callable") def test_data_allocation_function_returns_None(self): self.assertIsNone(self.build.allocate_to_office(), msg="method should return any value") self.assertIsNone(self.build.allocate_to_livingspace(), msg="method should not return any value") def test_data_is_printed(self): self.assertIsNone(self.build.allocated_members_list(), msg="method should print data and not return a value.") self.assertIsNone(self.build.unallocated_members_list(), msg="method should print data and not return a value.") self.assertIsNone(self.build.maleroom_members("opal"), msg="should print data and not return a value") self.assertIsNone(self.build.femaleroom_members("ruby"), msg="should print data and not return a value") self.assertIsNone(self.build.officeroom_members("Mint"), msg="should print data and not return a value")
'''Script use to view result of allocation.''' from building import Building from fileparser import Parser amity = Building('input.txt'); amity.populate_rooms() amity.get_fellows() amity.allocate_to_office() amity.allocate_to_livingspace() amity.allocated_members_list() amity.unallocated_members_list() amity.maleroom_members('opal') amity.femaleroom_members('ruby') amity.officeroom_members('Mint')