File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ import pytest
2
+ from scrapegraphai .utils .convert_to_md import convert_to_md
3
+
4
+ def test_basic_html_to_md ():
5
+ html = "<html><body><p>This is a paragraph.</p><h1>This is a heading.</h1></body></html>"
6
+ assert convert_to_md (html ) is not None
7
+
8
+ def test_html_with_links_and_images ():
9
+ html = '<p>This is a <a href="https://example.com">link</a> and this is an <img src="https://example.com/image.jpg" alt="image"></p>'
10
+ assert convert_to_md (html ) is None
11
+
12
+ def test_html_with_tables ():
13
+ html = '''
14
+ <table>
15
+ <tr><th>Header 1</th><th>Header 2</th></tr>
16
+ <tr><td>Row 1, Cell 1</td><td>Row 1, Cell 2</td></tr>
17
+ <tr><td>Row 2, Cell 1</td><td>Row 2, Cell 2</td></tr>
18
+ </table>
19
+ '''
20
+ assert convert_to_md (html ) is None
21
+
22
+ def test_empty_html ():
23
+ html = ""
24
+ assert convert_to_md (html ) is None
25
+
26
+ def test_complex_html_structure ():
27
+ html = '''
28
+ <html>
29
+ <body>
30
+ <h1>Main Heading</h1>
31
+ <p>This is a <strong>bold</strong> paragraph with <em>italic</em> text.</p>
32
+ <ul>
33
+ <li>First item</li>
34
+ <li>Second item</li>
35
+ <li>Third item</li>
36
+ </ul>
37
+ <p>Another paragraph with a <a href="https://example.com">link</a>.</p>
38
+ </body>
39
+ </html>
40
+ '''
41
+ assert convert_to_md (html ) is not None
You can’t perform that action at this time.
0 commit comments