Пример #1
0
 def test_splits_three_simple_groups(self):
     events = [FakeEvent(0.5)] * 3 + [FakeEvent(1.0)
                                      ] * 10 + [FakeEvent(0.5)] * 5
     groups = detect_groups(events, min_group_size=1)
     self.assertEqual(3, len(groups[0]))
     self.assertEqual(10, len(groups[1]))
     self.assertEqual(5, len(groups[2]))
Пример #2
0
 def test_merges_small_last_group_property(self):
     events = [FakeEvent(0.5)] * 10 + [FakeEvent(10)] * 10 + [FakeEvent(5)]
     groups = detect_groups(events, min_group_size=5)
     self.assertEqual(10, len(groups[0]))
     self.assertEqual(11, len(groups[1]))
Пример #3
0
 def test_does_nothing_when_there_is_only_wrong_groups(self):
     events = [FakeEvent(0.5)] * 2 + [FakeEvent(10)] * 3
     groups = detect_groups(events, min_group_size=5)
     self.assertEqual(2, len(groups[0]))
     self.assertEqual(3, len(groups[1]))
Пример #4
0
 def test_merges_small_groups_with_closest_large(self):
     events = [FakeEvent(0.5)] * 10 + [FakeEvent(0.8)
                                       ] + [FakeEvent(1.0)] * 10
     groups = detect_groups(events, min_group_size=5)
     self.assertEqual(10, len(groups[0]))
     self.assertEqual(11, len(groups[1]))
Пример #5
0
 def test_merges_two_consecutive_small_groups_with_closest_large(self):
     events = [FakeEvent(0.5)] * 20 + [FakeEvent(
         0.9)] * 10 + [FakeEvent(0.7)] * 10 + [FakeEvent(1.0)] * 20
     groups = detect_groups(events, min_group_size=15)
     self.assertEqual(20, len(groups[0]))
     self.assertEqual(40, len(groups[1]))
Пример #6
0
Файл: main.py Проект: tp7/Sushi
 def test_single_group_for_all_events(self):
     events = [FakeEvent(0.5)] * 10
     groups = sushi.detect_groups(events)
     self.assertEqual(10, len(groups[0]))
Пример #7
0
 def test_single_group_for_all_events(self):
     events = [FakeEvent(0.5)] * 10
     groups = detect_groups(events, min_group_size=1)
     self.assertEqual(10, len(groups[0]))
Пример #8
0
Файл: main.py Проект: tp7/Sushi
 def test_splits_three_simple_groups(self):
     events = [FakeEvent(0.5)] * 3 + [FakeEvent(1.0)] * 10 + [FakeEvent(0.5)] * 5
     groups = sushi.detect_groups(events)
     self.assertEqual(3, len(groups[0]))
     self.assertEqual(10, len(groups[1]))
     self.assertEqual(5, len(groups[2]))
Пример #9
0
 def test_merges_small_groups_with_closest_large(self):
     events = [FakeEvent(0.5)] * 10 + [FakeEvent(0.8)] + [FakeEvent(1.0)] * 10
     groups = detect_groups(events, min_group_size=5)
     self.assertEqual(10, len(groups[0]))
     self.assertEqual(11, len(groups[1]))
Пример #10
0
 def test_does_nothing_when_there_is_only_wrong_groups(self):
     events = [FakeEvent(0.5)] * 2 + [FakeEvent(10)] * 3
     groups = detect_groups(events, min_group_size=5)
     self.assertEqual(2, len(groups[0]))
     self.assertEqual(3, len(groups[1]))
Пример #11
0
 def test_merges_small_last_group_property(self):
     events = [FakeEvent(0.5)] * 10 + [FakeEvent(10)] * 10 + [FakeEvent(5)]
     groups = detect_groups(events, min_group_size=5)
     self.assertEqual(10, len(groups[0]))
     self.assertEqual(11, len(groups[1]))
Пример #12
0
 def test_merges_two_consecutive_small_groups_with_closest_large(self):
     events = [FakeEvent(0.5)] * 20 + [FakeEvent(0.9)] * 10 + [FakeEvent(0.7)] * 10 + [FakeEvent(1.0)] * 20
     groups = detect_groups(events, min_group_size=15)
     self.assertEqual(20, len(groups[0]))
     self.assertEqual(40, len(groups[1]))