def test_hour_sequence(): periods = 24 start = datetime(2012,1,1) delta = timedelta(hours=1) r = planner.hour_sequence(start) eq_(len(r),periods) total_delta = r[-1] - r[0] eq_(total_delta,delta*23) eq_(r[0].hour,12)
def test_properties_computed(): start_time = datetime(2012,1,1) times = planner.hour_sequence(start_time) observer = ephem.city('London') body = ephem.Sun() body.compute = mock.MagicMock(name='compute') builder = mock.MagicMock(name='builder') builder.return_value = {} plan = planner.create_plan_day(observer, [body], times, builder) expected_compute_calls = [mock.call(observer)]*24 compute_calls = body.compute.mock_calls expected_build_calls = [mock.call(body)]*24 build_calls = builder.mock_calls eq_(len(plan), 24)