Example #1
0
 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) == ''
Example #2
0
 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 !'
Example #3
0
 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 !'
Example #4
0
 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}')"
Example #5
0
 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) == ''
Example #6
0
 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 !'
Example #7
0
 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 !'
Example #8
0
 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) == ""
Example #9
0
 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) == ''
Example #10
0
 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 !'
Example #11
0
 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 !'