def test_multiple_groups_multiple_chapters(self): events = [FakeEvent(end=x) for x in xrange(1, 10)] groups = groups_from_chapters(events, [0.0, 3.2, 4.4, 7.7]) self.assertEqual(4, len(groups)) self.assertItemsEqual(events[0:3], groups[0]) self.assertItemsEqual(events[3:4], groups[1]) self.assertItemsEqual(events[4:7], groups[2]) self.assertItemsEqual(events[7:9], groups[3])
def test_multiple_groups_multiple_chapters(self): events = [FakeEvent(end=x) for x in xrange(1, 10)] groups = sushi.groups_from_chapters(events, [0.0, 3.2, 4.4, 7.7]) self.assertEqual(4, len(groups)) self.assertItemsEqual(events[0:3], groups[0]) self.assertItemsEqual(events[3:4], groups[1]) self.assertItemsEqual(events[4:7], groups[2]) self.assertItemsEqual(events[7:9], groups[3])
def test_events_in_two_groups_one_chapter(self): events = [FakeEvent(end=1), FakeEvent(end=2), FakeEvent(end=3)] groups = groups_from_chapters(events, [0.0, 1.5]) self.assertEqual(2, len(groups)) self.assertItemsEqual([events[0]], groups[0]) self.assertItemsEqual([events[1], events[2]], groups[1])
def test_all_events_in_one_group_when_no_chapters(self): events = [FakeEvent(end=1), FakeEvent(end=2), FakeEvent(end=3)] groups = groups_from_chapters(events, []) self.assertEqual(1, len(groups)) self.assertEqual(events, groups[0])
def test_all_events_in_one_group_when_no_chapters(self): events = [FakeEvent(end=1), FakeEvent(end=2), FakeEvent(end=3)] groups = sushi.groups_from_chapters(events, []) self.assertEqual(1, len(groups)) self.assertEqual(events, groups[0])
def test_events_in_two_groups_one_chapter(self): events = [FakeEvent(end=1), FakeEvent(end=2), FakeEvent(end=3)] groups = sushi.groups_from_chapters(events, [0.0, 1.5]) self.assertEqual(2, len(groups)) self.assertItemsEqual([events[0]], groups[0]) self.assertItemsEqual([events[1], events[2]], groups[1])