def test_extract_sections(): site = 'https://courses.edx.org' with open("test/html/single_unit_multiple_subs.html", "r") as f: sections = extract_sections_from_html(f.read(), site) assert len(sections) == 6 num_subsections = sum(len(section.subsections) for section in sections) assert num_subsections == 11
def test_extract_sections(file, num_sections_expected, num_subsections_expected): site = 'https://courses.edx.org' with open(file, "r") as f: sections = extract_sections_from_html(f.read(), site) assert len(sections) == num_sections_expected num_subsections = sum(len(section.subsections) for section in sections) assert num_subsections == num_subsections_expected
def test_extract_sections(self): with open("test/html/single_unit_multiple_subs.html", "r") as f: sections = extract_sections_from_html(f.read(), 'https://courses.edx.org') self.assertEquals(len(sections), 6) num_subsections = sum(len(section.subsections) for section in sections) self.assertEquals(num_subsections, 11)