Example #1
0
 def test_empty_block(self):
     try:
         res = change_empty_code_block_style("toto.md",
                                             "dd\n```\ndd\n```\ndd\n")
         assert res == "dd\n```txt\ndd\n```\ndd\n"
     except Exception as e:
         assert str(e) == ''
Example #2
0
 def test_multiple_code_blocks(self):
     try:
         res = change_empty_code_block_style(
             "toto.md",
             "dd\n```\ndd\n```\ndd\n```python\ndd\n```\ndd\n```\ndd\n```\ndd\n"
         )
         assert res == "dd\n```txt\ndd\n```\ndd\n```python\ndd\n```\ndd\n```txt\ndd\n```\ndd\n"
     except Exception as e:
         assert str(e) == '[Error] toto.md :: empty file !'
Example #3
0
 def test_wrong_block_number(self):
     try:
         res = change_empty_code_block_style(
             "toto.md", "dd\n```\ndd\n```\ndd\n```\ndd\n")
         assert res == ""
     except Exception as e:
         assert str(
             e
         ) == '[Error] toto.md:6 :: could not find closing code snippet !'
Example #4
0
 def test_empty_file(self):
     try:
         res = change_empty_code_block_style("toto.md", "")
         assert res == ""
     except Exception as e:
         assert str(e) == '[Error] toto.md :: empty file !'