def test_parsing_introduction_segment_and_section(self): segment = "introduction" lesson = "What's the weather like" section = "Recommended resources" sub_section = "" fetch_content = FetchFromES() results = fetch_content.fetch_lesson_content_from_es( "What's Weather like") parse_content = ParseESResults(results, segment, lesson, section) section_content = parse_content.parse_section_content("sections") self.assertIsNotNone(section_content)
def test_parsing_lesson_segment_and_section(self): segment = "lessons" lesson = "What's the weather like" section = "Introducing the Read Aloud" sub_section = "" fetch_content = FetchFromES() results = fetch_content.fetch_lesson_content_from_es( "What's Weather like") parse_content = ParseESResults(results, segment, lesson, section) section_content = parse_content.parse_section_content("sections") self.assertIsNotNone(section_content)
def test_parsing_lesson_segment_and_additional_section(self): segment = "lessons" lesson = "What's the weather like" section = "PRIMARY FOCUS OF LESSON" sub_section = "" fetch_content = FetchFromES() results = fetch_content.fetch_lesson_content_from_es( "What's Weather like") parse_content = ParseESResults(results, segment, lesson, section) section_content = parse_content.parse_section_content( "additional_sections") self.assertIsNotNone(section_content)
def read_section(self, segment, lesson, attr, section, query=""): """ attr :: sections/additional_sections (only for lessons segment) """ parse_content = ParseESResults(self.results, segment, lesson, section) section_content = parse_content.parse_section_content(attr) if section_content == None: if query == '': query = "this" return "Oops! There is no section with this title " + query + ". Please repeat the section title again." # response = fetch_ordinal_of_section(segment,section,attr) if segment == "lessons" and attr == "sections": sub_sections = [] for sub_section in section_content["sub_sections"]: sub_sections.append(sub_section["sub_section_name"]) response = section + " section contains " + str(len(sub_sections)) + " sub-sections.They are -" + ", ".join(sub_sections[:-1])+ ' and '+ sub_sections[-1]+ \ "<break time = '0.5s' />. You can ask me to repeat, skip or jump to the previous or next sub-section anytime" return response else: return self.change_dict_section_content_to_string_content( section_content, "section")