40d27cde0edb705bfa742a2f784d7a67b1d16e81,tests/helpers/test_event.py,TestEventHelpers,test_track_sunset,#TestEventHelpers#,348
Before Change
// Get next sunrise/sunset
astral = Astral()
utc_now = dt_util.utcnow()
mod = -1
while True:
next_setting = (astral.sunset_utc(utc_now +
After Change
// Get next sunrise/sunset
astral = Astral()
utc_now = datetime(2014, 5, 24, 12, 0, 0, tzinfo=dt_util.UTC)
utc_today = utc_now.date()
mod = -1
while True:
next_setting = (astral.sunset_utc(
utc_today + timedelta(days=mod), latitude, longitude))
if next_setting > utc_now:
break
mod += 1
// Track sunset
runs = []
with patch("homeassistant.util.dt.utcnow", return_value=utc_now):
unsub = track_sunset(self.hass, lambda: runs.append(1))
offset_runs = []
offset = timedelta(minutes=30)
with patch("homeassistant.util.dt.utcnow", return_value=utc_now):
unsub2 = track_sunset(
self.hass, lambda: offset_runs.append(1), offset)
// Run tests
self._send_time_changed(next_setting - offset)
self.hass.block_till_done()
self.assertEqual(0, len(runs))
self.assertEqual(0, len(offset_runs))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances
Project Name: home-assistant/home-assistant
Commit Name: 40d27cde0edb705bfa742a2f784d7a67b1d16e81
Time: 2017-05-09
Author: adam@armills.info
File Name: tests/helpers/test_event.py
Class Name: TestEventHelpers
Method Name: test_track_sunset
Project Name: home-assistant/home-assistant
Commit Name: 40d27cde0edb705bfa742a2f784d7a67b1d16e81
Time: 2017-05-09
Author: adam@armills.info
File Name: tests/components/test_sun.py
Class Name: TestSun
Method Name: test_setting_rising
Project Name: home-assistant/home-assistant
Commit Name: 40d27cde0edb705bfa742a2f784d7a67b1d16e81
Time: 2017-05-09
Author: adam@armills.info
File Name: tests/helpers/test_event.py
Class Name: TestEventHelpers
Method Name: test_track_sunset
Project Name: home-assistant/home-assistant
Commit Name: 40d27cde0edb705bfa742a2f784d7a67b1d16e81
Time: 2017-05-09
Author: adam@armills.info
File Name: tests/helpers/test_event.py
Class Name: TestEventHelpers
Method Name: test_track_sunrise