Пример #1
0
 def test_for_list_of_all_valid_links(self):
     all_links = []
     for c in hundredgreatest.get_all_compiled_links(
             hundredgreatest.raw_compiled_soups(
             hundredgreatest.setup(hundredgreatest.BASEURL))):
         for l in c:
             all_links.append(l)
     self.assertEqual(hundredgreatest.put_all_compiled_links_in_list(), all_links)
Пример #2
0
 def test_get_all_novel_titles(self):
     all_links = []
     for c in hundredgreatest.get_all_compiled_links(
             hundredgreatest.raw_compiled_soups(
             hundredgreatest.setup(hundredgreatest.BASEURL))):
         for l in c:
             all_links.append(l)
     regex_for_all_links = re.compile(r"<a.*\"(.*)\">(.*)</a>")
     regex_for_novel_titles = re.compile(r"<a.*>(The 100 best novels: No.*)</a>")
     novel_only_titles = []
     list_of_link_texts = []
     list_of_link_link_urls = []
     for link in all_links:
         r = re.search(regex_for_all_links, link)
         rn = re.search(regex_for_novel_titles, link)
         if r:
             list_of_link_texts.append(r.group(2))
             list_of_link_link_urls.append(r.group(1))
         if rn:
             novel_only_titles.append(rn.group(1))
     self.assertEqual(hundredgreatest.get_all_novel_titles(), novel_only_titles)
Пример #3
0
 def test_basic_set_up_of_base_page(self):
     self.assertEqual(hundredgreatest.setup(BEST_NOVELS), self.soup)