def test_create_sublists(self): entry_list = ['1','00:00:00,000 --> 00:00:02,000', "[D. Evans] Let's get started with programming.",'', '2', '00:00:02,000 --> 00:00:05,000','Programming is really the core of computer science.','', '3','00:00:05,000 --> 00:00:08,000','Most machines are designed to do just one thing.',''] expected =[['1', '00:00:00,000 --> 00:00:02,000', "[D. Evans] Let's get started with programming."], ['2', '00:00:02,000 --> 00:00:05,000','Programming is really the core of computer science.'], ['3','00:00:05,000 --> 00:00:08,000','Most machines are designed to do just one thing.'] ] sub_lists = create_sublists(entry_list) self.assertEquals(expected,sub_lists)
def test_create_sublists__mult_textlines(self): input = ['1', '00:00:00,000 --> 00:00:02,000', "[D. Evans] Let's get started with programming.", '', '2', '00:00:02,000 --> 00:00:05,000', 'Programming is really the core of computer science.', 'Programmers are not aliens', 'even though they have strange habits,', 'like mumbling to themselves while working.', '', '3', '00:00:05,000 --> 00:00:08,000', 'Most machines are designed to do just one thing.', ''] sub_lists = create_sublists(input) expected = [ ['1', '00:00:00,000 --> 00:00:02,000', "[D. Evans] Let's get started with programming."], ['2', '00:00:02,000 --> 00:00:05,000', 'Programming is really the core of computer science. Programmers are not aliens even though they have strange habits, like mumbling to themselves while working.'], ['3', '00:00:05,000 --> 00:00:08,000', 'Most machines are designed to do just one thing.'] ] self.assertEquals(expected,sub_lists)