Example #1
0
 def test_parse_desc_offsets(self):
     events = [Event(description="ch1+30-60")]
     actions = list(extract_actions(events))
     exp = [Action(events[0]["start"] + timedelta(minutes=30),
                             {1: "on"}, "summary"),
            Action(events[0]["end"] - timedelta(minutes=60),
                             {1: "auto"}, "summary")]
     self.assertEqual(exp, actions)
Example #2
0
 def test_parse_desc(self):
     events = [Event(description="j ch0 adsf ch2")]
     actions = list(extract_actions(events))
     exp = [Action(events[0]["start"], {0: "on"}, "summary"),
            Action(events[0]["end"], {0: "auto"}, "summary"),
            Action(events[0]["start"], {2: "on"}, "summary"),
            Action(events[0]["end"], {2: "auto"}, "summary")]
     self.assertEqual(exp, actions)
Example #3
0
 def test_parse_desc_offset(self):
     events = [Event(description="ch1+60")]
     actions = list(extract_actions(events))
     actions2 = list(extract_actions_from_desc(events[0]))
     self.assertEqual(actions, actions2)
     exp = [Action(events[0]["start"] + timedelta(minutes=60),
                             {1: "on"}, "summary"),
            Action(events[0]["end"], {1: "auto"}, "summary")]
     self.assertEqual(exp, actions)
Example #4
0
 def test_parse_desc_offsets_neg_duration(self):
     events = [Event(description="ch1+60-90")]
     actions = list(extract_actions(events))
     self.assertEqual([], actions)
Example #5
0
 def test_parse_empty_event(self):
     self.assertEqual([], list(extract_actions([Event()])))
Example #6
0
 def test_parse_event(self):
     events = [Event(summary="x ch0 adsf")]
     actions = list(extract_actions(events))
     exp = [Action(events[0]["start"], {0: "on"}, "x ch0 adsf"),
            Action(events[0]["end"], {0: "auto"}, "x ch0 adsf")]
     self.assertEqual(exp, actions)