Exemple #1
0
 def test_simplify_comments(self):
     events = [Event(summary="ch0 com0"),
               Event(summary="ch1 com1", end=NOW + timedelta(hours=3)),
               Event(summary="ch2 com0", start=NOW + timedelta(hours=1))]
     labels = [simplify_label(action)
               for action in get_combined_actions(events)]
     self.assertEqual(labels[2], "com0")
     self.assertIn(labels[0], ("com0 + com1", "com1 + com0"))
Exemple #2
0
 def test_parse_event_combiner(self):
     events = [Event(summary="ch0 com0"),
               Event(summary="ch1 com1", end=NOW + timedelta(hours=3)),
               Event(summary="ch2 com0", start=NOW + timedelta(hours=1))]
     actions = get_combined_actions(events)
     exp = [Action(events[0]["start"], {0: "on", 1: "on"},
                   "ch0 com0 + ch1 com1"),
            Action(events[2]["start"], {2: "on"}, "ch2 com0"),
            Action(events[0]["end"], {0: "auto", 2: "auto"},
                   "ch0 com0 + ch2 com0"),
            Action(events[1]["end"], {1: "auto"}, "ch1 com1")]
     self.assertEqual(exp, actions)