예제 #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
파일: main.py 프로젝트: shinchiro/Sushi
 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
파일: main.py 프로젝트: shinchiro/Sushi
 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
파일: main.py 프로젝트: shinchiro/Sushi
 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
파일: main.py 프로젝트: shinchiro/Sushi
 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]))