Best Python code snippet using Kiwi_python
test_markdown.py
Source:test_markdown.py
...3from tcms.core.templatetags.extra_filters import markdown2html4class TestMarkdownExtraFilters(unittest.TestCase):5 def test_markdown2html_convert_paragraphs(self):6 self.assertEqual(7 markdown2html("__*hello!*__"), "<p><strong><em>hello!</em></strong></p>"8 )9 def test_markdown2html_convert_tables(self):10 self.assertEqual(11 markdown2html("""|Stx |Desc |\n|----|-----|\n|Head|Title|\n|Txt|Txt |"""),12 """<table>13<thead>14<tr>15<th>Stx</th>16<th>Desc</th>17</tr>18</thead>19<tbody>20<tr>21<td>Head</td>22<td>Title</td>23</tr>24<tr>25<td>Txt</td>26<td>Txt</td>27</tr>28</tbody>29</table>""",30 )31 def test_markdown2html_convert_nl2br(self):32 self.assertEqual(33 markdown2html(34 """Line 135Line 2"""36 ),37 """<p>Line 1<br>38Line 2</p>""",39 )40 def test_markdown2html_convert_fenced_code(self):41 self.assertEqual(42 markdown2html(43 """```{44"firstName": "John",45"lastName": "Smith",46"age": 25}``` """47 ),48 """<p><code>{49"firstName": "John",50"lastName": "Smith",51"age": 25}</code> </p>""",52 )53 def test_markdown2html_with_codehilite(self):54 self.assertEqual(55 markdown2html(56 """```python57def hello():58 pass59```"""60 ),61 """<div class="codehilite"><pre><span></span>\62<code><span class="k">def</span> <span class="nf">hello</span><span class="p">():</span>63 <span class="k">pass</span>64</code></pre></div>""",65 )66 def test_markdown2html_does_bleach_unsafe_code(self):67 self.assertEqual(68 markdown2html("### hello <script>alert('gotcha');</script>"),69 "<h3>hello <script>alert('gotcha');</script></h3>",70 )71 self.assertEqual(72 markdown2html("<canvas><bgsound><audio><applet>"),73 "<canvas><bgsound><audio><applet>",74 )75 self.assertEqual(76 markdown2html(77 """_hello_ <html><head></head>78<body></body></html>"""79 ),80 """<p><em>hello</em> <html><head></head></p>81<body></body>\n<p></html></p>""",82 )83 self.assertEqual(84 markdown2html(85 """__hello__ <xmp><video><track>86<title><rt><ruby><param>"""87 ),88 """<p><strong>hello</strong> <xmp><video><track><br>89<title><rt><ruby><param></p>""",90 )91 self.assertEqual(92 markdown2html(93 """*hello* <object><link><iframe>94<frame><frameset><embed>"""95 ),96 """<p><em>hello</em> <object><link><iframe><br>97<frame><frameset><embed></p>""",...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!