MCPcopy Create free account
hub / github.com/NanoNets/docstrange / test_basic_structure

Function test_basic_structure

tests/test_json_structure.py:11–47  ·  view source on GitHub ↗

Test basic markdown structure parsing.

()

Source from the content-addressed store, hash-verified

9from docstrange.result import ConversionResult
10
11def test_basic_structure():
12 """Test basic markdown structure parsing."""
13 markdown_content = """# Main Title
14
15This is a paragraph under the main title.
16
17## Section 1
18
19Here's some content in section 1.
20
21### Subsection 1.1
22
23More content here.
24
25## Section 2
26
27Another 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
49def test_content_types():
50 """Test different content types parsing."""

Callers 1

mainFunction · 0.85

Calls 2

extract_dataMethod · 0.95
ConversionResultClass · 0.90

Tested by

no test coverage detected