示例#1
0
def test_schedule_day_init_from_values_at_timestep():
    """Test the initialization of ScheduleDay from_values_at_timestep."""
    simple_office = ScheduleDay('Simple Office Occupancy', [0, 1, 0],
                                [Time(0, 0), Time(9, 0), Time(17, 0)])
    half_hour_vals = simple_office.values_at_timestep(2)
    test_sched = ScheduleDay.from_values_at_timestep('Simple Office Occupancy',
                                                     half_hour_vals, 2)

    assert test_sched == simple_office
示例#2
0
def test_schedule_day_init_from_values():
    """Test the initialization of ScheduleDay from_values_at_timestep."""
    test_vals = [
        0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 1, 1, 1, 1, 1, 1, 0.5, 0.5, 0.5, 0.5, 1,
        1, 1, 1, 0.5, 0.5, 0.5, 0.5
    ]
    test_sched = ScheduleDay.from_values_at_timestep('Test Schedule',
                                                     test_vals)

    assert test_sched.values == (0.5, 1.0, 0.5, 1.0, 0.5)
    assert test_sched.times == (Time(0, 0), Time(6, 0), Time(12,
                                                             0), Time(16, 0),
                                Time(20, 0))

    test_sched_2 = ScheduleDay.from_values_at_timestep('Test Schedule',
                                                       test_vals,
                                                       remove_repeated=False)
    assert test_sched_2.values == tuple(test_vals)
    assert test_sched_2.values_at_timestep() == test_vals
    assert len(test_sched_2.times) == 24