Test basic markdown structure parsing.
()
| 9 | from docstrange.result import ConversionResult |
| 10 | |
| 11 | def test_basic_structure(): |
| 12 | """Test basic markdown structure parsing.""" |
| 13 | markdown_content = """# Main Title |
| 14 | |
| 15 | This is a paragraph under the main title. |
| 16 | |
| 17 | ## Section 1 |
| 18 | |
| 19 | Here's some content in section 1. |
| 20 | |
| 21 | ### Subsection 1.1 |
| 22 | |
| 23 | More content here. |
| 24 | |
| 25 | ## Section 2 |
| 26 | |
| 27 | Another section with content. |
| 28 | """ |
| 29 | |
| 30 | result = ConversionResult(markdown_content, {"source": "test"}) |
| 31 | json_data = result.extract_data() |
| 32 | |
| 33 | print("=== Basic Structure Test ===") |
| 34 | print(json.dumps(json_data, indent=2)) |
| 35 | |
| 36 | # Verify structure |
| 37 | assert "document" in json_data |
| 38 | assert "sections" in json_data["document"] |
| 39 | assert len(json_data["document"]["sections"]) == 1 # Main Title |
| 40 | |
| 41 | main_section = json_data["document"]["sections"][0] |
| 42 | assert main_section["title"] == "Main Title" |
| 43 | assert main_section["level"] == 1 |
| 44 | assert "subsections" in main_section |
| 45 | assert len(main_section["subsections"]) == 2 # Section 1 and 2 |
| 46 | |
| 47 | print("✓ Basic structure test passed\n") |
| 48 | |
| 49 | def test_content_types(): |
| 50 | """Test different content types parsing.""" |
no test coverage detected