def test_internal_link_06(self, heading_text, link_text, word_ending): """Test internal_link parser element. :param str heading_text: heading_text :param str link_text: link_text :param str word_ending: word_ending internal_link = "[[", anchor, "|", link_text, "]]", word_ending; """ anchor = strategies.links.anchor(heading_text=heading_text) piped = "|" + link_text internal_link = strategies.links.internal_link( anchor, piped=piped, word_ending_=word_ending) namespaces = self._get_namespaces() parser_element = links.get_internal_link(namespaces) parse_results = parser_element.parseString(internal_link) self.assertNotIn("page_name", parse_results["internal_link"]) self.assertEqual( heading_text, parse_results["internal_link"]["anchor"]["heading_text"]) self.assertEqual(link_text, parse_results["internal_link"]["link_text"]) self.assertEqual(word_ending, parse_results["internal_link"]["word_ending"]) return
def test_internal_link_05(self, namespace, page_name, link_text, word_ending): """Test internal_link parser element. :param str namespace: namespace :param str page_name: page_name :param str link_text: link_text :param str word_ending: word_ending internal_link = "[[", namespace, ":", page_name, "|", link_text, "]]", word_ending; """ namespace_prefix = namespace + ":" piped = "|" + link_text internal_link = strategies.links.internal_link( page_name, namespace_prefix=namespace_prefix, piped=piped, word_ending_=word_ending) namespaces = self._get_namespaces() parser_element = links.get_internal_link(namespaces) parse_results = parser_element.parseString(internal_link) self.assertEqual(namespace, parse_results["internal_link"]["namespace"]) self.assertEqual(page_name, parse_results["internal_link"]["page_name"]) self.assertEqual(link_text, parse_results["internal_link"]["link_text"]) self.assertEqual(word_ending, parse_results["internal_link"]["word_ending"]) return
def test_internal_link_00(self, page_name): """Test internal_link parser element. :param str page_name: page_name internal_link = "[[", page_name, "]]"; """ internal_link = strategies.links.internal_link(page_name) namespaces = self._get_namespaces() parser_element = links.get_internal_link(namespaces) parse_results = parser_element.parseString(internal_link) self.assertEqual(page_name, parse_results["internal_link"]["page_name"]) return
def test_internal_link_03(self, namespace, page_name): """Test internal_link parser element. :param str namespace: namespace :param str page_name: page_name internal_link = "[[", namespace, ":", page_name, "|", "]]"; """ namespace_prefix = namespace + ":" piped = "|" internal_link = strategies.links.internal_link( page_name, namespace_prefix=namespace_prefix, piped=piped) namespaces = self._get_namespaces() parser_element = links.get_internal_link(namespaces) parse_results = parser_element.parseString(internal_link) self.assertEqual(namespace, parse_results["internal_link"]["namespace"]) self.assertEqual(page_name, parse_results["internal_link"]["page_name"]) self.assertNotIn("link_text", parse_results["internal_link"]) return
def test_internal_link_07(self, namespace, page_name, heading_text): """Test internal_link parser element. :param str namespace: namespace :param str page_name: page_name :param str heading_text: heading_text internal_link = "[[", namespace, ":", page_name, anchor, "]]"; """ namespace_prefix = namespace + ":" anchor = strategies.links.anchor(heading_text=heading_text) internal_link = strategies.links.internal_link( page_name + anchor, namespace_prefix=namespace_prefix) namespaces = self._get_namespaces() parser_element = links.get_internal_link(namespaces) parse_results = parser_element.parseString(internal_link) self.assertEqual(namespace, parse_results["internal_link"]["namespace"]) self.assertEqual(page_name, parse_results["internal_link"]["page_name"]) self.assertEqual( heading_text, parse_results["internal_link"]["anchor"]["heading_text"]) return