def test_empty_html_image_title2(self): try: res = change_img_format("toto.md", """<img src="src/toto.png" />\n""") assert res == "\n![toto](tmp/assets/toto.png)\n" except Exception as e: assert str(e) == ''
def test_empty_image_space_front(self): try: res = change_img_format("toto.md", " ![toto](src/toto.png){width=450px}\n") assert res == "\n![toto](tmp/assets/toto.png){width=450px}\n" except Exception as e: assert str(e) == '[Error] toto.md:1 :: empty image path !'
def test_images_multi_lines(self): try: res = change_img_format( "toto.md", """1\n\n![toto](src/toto.png){width=450px}\n\n2\n""") assert res == "1\n\n\n![toto](tmp/assets/toto.png){width=450px}\n\n2\n" except Exception as e: assert str(e) == '[Error] toto.md:1 :: empty image path !'
def test_image_md_style_ko(self): try: res = change_img_format("toto.md", "![title](path){width=450x}") assert res == "" except Exception as e: assert str( e ) == "[Error] toto.md:1 :: wrong image style format ! (example: '{width=250px}')"
def test_no_images_multi_lines(self): try: res = change_img_format("toto.md", """\n\n1\n\n2\n\n""") assert res == "\n\n1\n\n2\n" except Exception as e: assert str(e) == ''
def test_empty_html_image_space_front(self): try: res = change_img_format("toto.md", " <img src='src/toto.png' />\n") assert res == "\n![toto](tmp/assets/toto.png)\n" except Exception as e: assert str(e) == '[Error] toto.md:1 :: empty image path !'
def test_empty_html_image_path(self): try: res = change_img_format("toto.md", "<img src='' />\n") assert res == "" except Exception as e: assert str(e) == '[Error] toto.md:1 :: empty image path !'
def test_image_md_ok(self): try: res = change_img_format("toto.md", "![title](path){width=450px}\n") assert res == "\n![title](tmp/assets/path){width=450px}\n" except Exception as e: assert str(e) == ""
def test_empty_image_style(self): try: res = change_img_format("toto.md", r"![title](path)\{\}") assert res == "\n![title](tmp/assets/path)\n" except Exception as e: assert str(e) == ''
def test_empty_image_path(self): try: res = change_img_format("toto.md", "![title]()") assert res == "" except Exception as e: assert str(e) == '[Error] toto.md:1 :: empty image path !'
def test_empty_file(self): try: res = change_img_format("toto.md", "") assert res == "" except Exception as e: assert str(e) == '[Error] toto.md :: empty file !'