def test_link_is_not_defined(self): try: Inline.new_link() except TypeError: return self.fail()
def new_inline_link(self, link, text=None, bold_italics_code='', align=''): """Creates a inline link in markdown format. :param link: :type link: str :param text: Text that is going to be displayed in the markdown file as a link. :type text: str :param bold_italics_code: Using ``'b'``: **bold**, ``'i'``: *italics* and ``'c'``: ``inline_code``... :type bold_italics_code: str :param align: Using this parameter you can align text. For example ``'right'``, ``'left'`` or ``'center'``. :type align: str :return: returns the link in markdown format ``'[ + text + '](' + link + ')'``. If text is not defined returns \ ``'<' + link + '>'``. :rtype: str .. note:: If param text is not provided, link param will be used instead. """ if text is None: n_text = link else: n_text = text if bold_italics_code or align: n_text = self.textUtils.text_format( text=n_text, bold_italics_code=bold_italics_code, align=align) return Inline.new_link(link=link, text=n_text)
def test_link_tooltip(self): expected_link = '[' + self.text + '](' + self.link + " '{}'".format( self.tooltip) + ')' actual_link = Inline.new_link(link=self.link, text=self.text, tooltip=self.tooltip) self.assertEqual(expected_link, actual_link)
def new_inline_image(text, path, tooltip=None): """ :param text: Text that is going to be displayed in the markdown file as a iamge. :type text: str :param path: Image's path / link. :type path: str :param tooltip: :type tooltip: str :return: return the image in markdown format ``'![ + text + '](' + path + 'tooltip' + ')'``. :rtype: str """ return '!' + Inline.new_link(link=path, text=text, tooltip=tooltip)
def test_text_is_not_defined(self): expected_link = '<' + self.link + '>' actual_link = Inline.new_link(link=self.link) self.assertEqual(expected_link, actual_link)
def test_inline_link(self): expected_link = '[' + self.text + '](' + self.link + ')' actual_link = Inline.new_link(link=self.link, text=self.text) self.assertEqual(expected_link, actual_link)