def test_program_type_lockability(): """Test the lockability of ProgramType objects.""" simple_office = ScheduleDay('Simple Weekday Occupancy', [0, 1, 0], [Time(0, 0), Time(9, 0), Time(17, 0)]) light_schedule = ScheduleRuleset('Office Lighting-Equip Schedule', simple_office, None, schedule_types.fractional) lighting = Lighting('Open Office Lighting', 10, light_schedule) led_lighting = Lighting('LED Office Lighting', 5, light_schedule) office_program = ProgramType('Open Office Program', lighting=lighting) office_program.lighting.watts_per_area = 6 office_program.lock() with pytest.raises(AttributeError): office_program.lighting.watts_per_area = 8 with pytest.raises(AttributeError): office_program.lighting = led_lighting office_program.unlock() office_program.lighting.watts_per_area = 8 office_program.lighting = led_lighting
from honeybee_energy.load.lighting import Lighting from honeybee_energy.load.equipment import ElectricEquipment from honeybee_energy.load.infiltration import Infiltration from honeybee_energy.load.ventilation import Ventilation from honeybee_energy.load.setpoint import Setpoint from ._loadprogramtypes import _json_program_types import honeybee_energy.lib.schedules as _s # establish variables for the default schedules used across the library # and auto-generate schedules if they were not loaded from default.idf try: plenum_program = _json_program_types['Plenum'] except KeyError: plenum_program = ProgramType('Plenum') plenum_program.lock() _json_program_types['Plenum'] = plenum_program try: office_program = _json_program_types['Generic Office Program'] except KeyError: if _s.generic_office_occupancy is not None: people = People('Generic Office People', 0.0565, _s.generic_office_occupancy, _s.generic_office_activity) lighting = Lighting('Generic Office Lighting', 10.55, _s.generic_office_lighting, 0.0, 0.7, 0.2) equipment = ElectricEquipment('Generic Office Equipment', 10.33, _s.generic_office_equipment, 0.5) infiltration = Infiltration('Generic Office Infiltration', 0.0002266, _s.generic_office_infiltration)