import unittest from extract import extract_markdown_images, extract_markdown_links class TextExtract(unittest.TestCase): def test_extract_markdown_images_when_given_no_images_it_should_return_empty_list( self, ): result = extract_markdown_images("") self.assertListEqual(result, []) def test_extract_markdown_images_when_given_images_it_should_return_list( self, ): expected = [ ("rick roll", "https://i.imgur.com/aKaOqIh.gif"), ("obi wan", "https://i.imgur.com/fJRm4Vk.jpeg") ] result = extract_markdown_images("This is text with a ![rick roll](https://i.imgur.com/aKaOqIh.gif) and ![obi wan](https://i.imgur.com/fJRm4Vk.jpeg)") self.assertListEqual(result, expected) def test_extract_markdown_links_when_given_no_links_it_should_return_empty_list( self, ): result = extract_markdown_links("") self.assertListEqual(result, []) def test_extract_markdown_links_when_given_links_it_should_return_list( self, ): expected = [ ("to boot dev", "https://www.boot.dev"), ("to youtube", "https://www.youtube.com/@bootdotdev") ] result = extract_markdown_links("This is text with a link [to boot dev](https://www.boot.dev) and [to youtube](https://www.youtube.com/@bootdotdev)") self.assertListEqual(result, expected)