def test_lighting_lockability(): """Test the lockability of Lighting objects.""" weekday_office = ScheduleDay( 'Weekday Office Lighting', [0, 1, 0], [Time(0, 0), Time(9, 0), Time(17, 0)]) saturday_office = ScheduleDay( 'Saturday Office Lighting', [0, 0.25, 0], [Time(0, 0), Time(9, 0), Time(17, 0)]) weekend_rule = ScheduleRule(saturday_office) weekend_rule.apply_weekend = True schedule = ScheduleRuleset('Office Lighting', weekday_office, [weekend_rule], schedule_types.fractional) lighting = Lighting('Open Office Zone Lighting', 10, schedule) lighting.watts_per_area = 6 lighting.lock() with pytest.raises(AttributeError): lighting.watts_per_area = 8 with pytest.raises(AttributeError): lighting.schedule.default_day_schedule.remove_value_by_time(Time( 17, 0)) lighting.unlock() lighting.watts_per_area = 8 with pytest.raises(AttributeError): lighting.schedule.default_day_schedule.remove_value_by_time(Time( 17, 0))
def test_lighting_setability(): """Test the setting of properties of Lighting.""" simple_office = ScheduleDay( 'Simple Weekday Light', [0, 1, 0], [Time(0, 0), Time(9, 0), Time(17, 0)]) schedule = ScheduleRuleset('Office Lighting', simple_office, None, schedule_types.fractional) constant = ScheduleRuleset.from_constant_value('Constant Light', 1, schedule_types.fractional) lighting = Lighting('Open Office Zone Lighting', 10, schedule) lighting.identifier = 'Office Zone Lighting' assert lighting.identifier == 'Office Zone Lighting' lighting.watts_per_area = 6 assert lighting.watts_per_area == 6 lighting.schedule = constant assert lighting.schedule == constant assert lighting.schedule.values() == [1] * 8760 lighting.return_air_fraction = 0.1 assert lighting.return_air_fraction == 0.1 lighting.radiant_fraction = 0.4 assert lighting.radiant_fraction == 0.4 lighting.visible_fraction = 0.2 assert lighting.visible_fraction == 0.2 lighting.baseline_watts_per_area = 5.0 assert lighting.baseline_watts_per_area == 5.0