From 69f3d56f2d9ce81a43bf3f446f4ab43f57daee53 Mon Sep 17 00:00:00 2001 From: Philip Rosenberg-Watt Date: Fri, 23 Mar 2018 12:33:03 -0600 Subject: [PATCH] Revert code cleanup --- tests/components/calendar/test_google.py | 55 ++++++++++++++---------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/tests/components/calendar/test_google.py b/tests/components/calendar/test_google.py index e29c5f3b73a..d0e019b5d82 100644 --- a/tests/components/calendar/test_google.py +++ b/tests/components/calendar/test_google.py @@ -42,16 +42,16 @@ class TestComponentsGoogleCalendar(unittest.TestCase): @patch('homeassistant.components.calendar.google.GoogleCalendarData') def test_all_day_event(self, mock_next_event): """Test that we can create an event trigger on device.""" - week_from_today = dt_util.dt.date.today() + dt_util.dt.timedelta( - days=7) + week_from_today = dt_util.dt.date.today() \ + + dt_util.dt.timedelta(days=7) event = { 'summary': 'Test All Day Event', 'start': { 'date': week_from_today.isoformat() }, 'end': { - 'date': (week_from_today + dt_util.dt.timedelta( - days=1)).isoformat() + 'date': (week_from_today + dt_util.dt.timedelta(days=1)) + .isoformat() }, 'location': 'Test Cases', 'description': 'We\'re just testing that all day events get setup ' @@ -105,14 +105,16 @@ class TestComponentsGoogleCalendar(unittest.TestCase): @patch('homeassistant.components.calendar.google.GoogleCalendarData') def test_future_event(self, mock_next_event): """Test that we can create an event trigger on device.""" - one_hour_from_now = dt_util.now() + dt_util.dt.timedelta(minutes=30) + one_hour_from_now = dt_util.now() \ + + dt_util.dt.timedelta(minutes=30) event = { 'start': { 'dateTime': one_hour_from_now.isoformat() }, 'end': { 'dateTime': (one_hour_from_now - + dt_util.dt.timedelta(minutes=60)).isoformat() + + dt_util.dt.timedelta(minutes=60)) + .isoformat() }, 'summary': 'Test Event in 30 minutes', 'reminders': {'useDefault': True}, @@ -155,8 +157,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase): 'offset_reached': False, 'start_time': one_hour_from_now.strftime(DATE_STR_FORMAT), 'end_time': - (one_hour_from_now + dt_util.dt.timedelta( - minutes=60)).strftime(DATE_STR_FORMAT), + (one_hour_from_now + dt_util.dt.timedelta(minutes=60)) + .strftime(DATE_STR_FORMAT), 'location': '', 'description': '' }) @@ -164,14 +166,16 @@ class TestComponentsGoogleCalendar(unittest.TestCase): @patch('homeassistant.components.calendar.google.GoogleCalendarData') def test_in_progress_event(self, mock_next_event): """Test that we can create an event trigger on device.""" - middle_of_event = dt_util.now() - dt_util.dt.timedelta(minutes=30) + middle_of_event = dt_util.now() \ + - dt_util.dt.timedelta(minutes=30) event = { 'start': { 'dateTime': middle_of_event.isoformat() }, 'end': { - 'dateTime': (middle_of_event + dt_util.dt.timedelta( - minutes=60)).isoformat() + 'dateTime': (middle_of_event + dt_util.dt + .timedelta(minutes=60)) + .isoformat() }, 'summary': 'Test Event in Progress', 'reminders': {'useDefault': True}, @@ -215,8 +219,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase): 'offset_reached': False, 'start_time': middle_of_event.strftime(DATE_STR_FORMAT), 'end_time': - (middle_of_event + dt_util.dt.timedelta(minutes=60)).strftime( - DATE_STR_FORMAT), + (middle_of_event + dt_util.dt.timedelta(minutes=60)) + .strftime(DATE_STR_FORMAT), 'location': '', 'description': '' }) @@ -224,15 +228,17 @@ class TestComponentsGoogleCalendar(unittest.TestCase): @patch('homeassistant.components.calendar.google.GoogleCalendarData') def test_offset_in_progress_event(self, mock_next_event): """Test that we can create an event trigger on device.""" - middle_of_event = dt_util.now() + dt_util.dt.timedelta(minutes=14) + middle_of_event = dt_util.now() \ + + dt_util.dt.timedelta(minutes=14) event_summary = 'Test Event in Progress' event = { 'start': { 'dateTime': middle_of_event.isoformat() }, 'end': { - 'dateTime': (middle_of_event + dt_util.dt.timedelta( - minutes=60)).isoformat() + 'dateTime': (middle_of_event + dt_util.dt + .timedelta(minutes=60)) + .isoformat() }, 'summary': '{} !!-15'.format(event_summary), 'reminders': {'useDefault': True}, @@ -275,8 +281,9 @@ class TestComponentsGoogleCalendar(unittest.TestCase): 'all_day': False, 'offset_reached': True, 'start_time': middle_of_event.strftime(DATE_STR_FORMAT), - 'end_time': (middle_of_event + dt_util.dt.timedelta( - minutes=60)).strftime(DATE_STR_FORMAT), + 'end_time': + (middle_of_event + dt_util.dt.timedelta(minutes=60)) + .strftime(DATE_STR_FORMAT), 'location': '', 'description': '' }) @@ -285,7 +292,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase): @patch('homeassistant.components.calendar.google.GoogleCalendarData') def test_all_day_offset_in_progress_event(self, mock_next_event): """Test that we can create an event trigger on device.""" - tomorrow = dt_util.dt.date.today() + dt_util.dt.timedelta(days=1) + tomorrow = dt_util.dt.date.today() \ + + dt_util.dt.timedelta(days=1) event_summary = 'Test All Day Event Offset In Progress' event = { @@ -294,7 +302,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase): 'date': tomorrow.isoformat() }, 'end': { - 'date': (tomorrow + dt_util.dt.timedelta(days=1)).isoformat() + 'date': (tomorrow + dt_util.dt.timedelta(days=1)) + .isoformat() }, 'location': 'Test Cases', 'description': 'We\'re just testing that all day events get setup ' @@ -349,7 +358,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase): @patch('homeassistant.components.calendar.google.GoogleCalendarData') def test_all_day_offset_event(self, mock_next_event): """Test that we can create an event trigger on device.""" - tomorrow = dt_util.dt.date.today() + dt_util.dt.timedelta(days=2) + tomorrow = dt_util.dt.date.today() \ + + dt_util.dt.timedelta(days=2) offset_hours = (1 + dt_util.now().hour) event_summary = 'Test All Day Event Offset' @@ -359,7 +369,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase): 'date': tomorrow.isoformat() }, 'end': { - 'date': (tomorrow + dt_util.dt.timedelta(days=1)).isoformat() + 'date': (tomorrow + dt_util.dt.timedelta(days=1)) + .isoformat() }, 'location': 'Test Cases', 'description': 'We\'re just testing that all day events get setup '