def test_extract_sections_subparts(self): sub1 = [{ 'section_id': '8888-1', 'index': ['8888', '1'] }, { 'section_id': '8888-3', 'index': ['8888', '3'] }] sub2 = [{'section_id': '8888-7', 'index': ['8888', '7']}] toc = [ { 'section_id': '8888-Subpart-A', 'index': ['8888', 'Subpart', 'A'], 'sub_toc': sub1 }, { 'section_id': '8888-Subjgrp-IND', 'index': ['8888', 'Subjgrp', 'IND'], 'sub_toc': sub2 }, { 'section_id': '8888-Interp', 'index': ['8888', 'Interp'] }, ] sections = views_diff.extract_sections(toc) self.assertEqual(['8888', '1'], sections[0]['index']) self.assertEqual(['8888', '3'], sections[1]['index']) self.assertEqual(['8888', '7'], sections[2]['index']) self.assertEqual(['8888', 'Interp'], sections[3]['index'])
def test_extract_sections(self): toc = [{'section_id': '8888-1', 'index': ['8888', '1']}, {'section_id': '8888-3', 'index': ['8888', '3']}] sections = views_diff.extract_sections(toc) self.assertEqual(['8888', '1'], sections[0]['index']) self.assertEqual(['8888', '3'], sections[1]['index'])
def test_extract_sections_subparts(self): sub1 = [{'section_id': '8888-1', 'index': ['8888', '1']}, {'section_id': '8888-3', 'index': ['8888', '3']}] sub2 = [{'section_id': '8888-7', 'index': ['8888', '7']}] toc = [ {'section_id': '8888-Subpart-A', 'index': ['8888', 'Subpart', 'A'], 'sub_toc': sub1}, {'section_id': '8888-Subjgrp-IND', 'index': ['8888', 'Subjgrp', 'IND'], 'sub_toc': sub2}, {'section_id': '8888-Interp', 'index': ['8888', 'Interp']}, ] sections = views_diff.extract_sections(toc) self.assertEqual(['8888', '1'], sections[0]['index']) self.assertEqual(['8888', '3'], sections[1]['index']) self.assertEqual(['8888', '7'], sections[2]['index']) self.assertEqual(['8888', 'Interp'], sections[3]['index'])