Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

Add test to validate markdown files referenced in mkdocs.yml (#1730)

sushmanth reddyb88caa322851
diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml
index 37e57034e..a98084ba6 100644
--- a/docs/mkdocs.yml
+++ b/docs/mkdocs.yml
@@ -32,7 +32,7 @@ nav:
- ReAct: deep-dive/modules/react.md
- MultiChainComparison: deep-dive/modules/multi-chain-comparison.md
- ProgramOfThought: deep-dive/modules/program-of-thought.md
- - Assertions: deep-dive/modules/assertions.md
+ - Assertions: deep-dive/assertions.md
- Retreive: deep-dive/modules/retrieve.md
- Modules Guide: deep-dive/modules/guide.md
- Metrics and Assertions:
diff --git a/tests/docs/test_mkdocs_links.py b/tests/docs/test_mkdocs_links.py
new file mode 100644
index 000000000..5d5fe7c54
--- /dev/null
+++ b/tests/docs/test_mkdocs_links.py
@@ -0,0 +1,40 @@
+
+
+import pytest
+import os
+
+def test_nav_files_exist():
+ # Read mkdocs.yml
+ docs_dir = os.path.join(os.path.dirname(__file__), '..', '..', 'docs', 'docs')
+ yaml_path = os.path.join(os.path.dirname(__file__), '..', '..', 'docs', 'mkdocs.yml')
+
+ # Read file and extract nav section
+ with open(yaml_path) as f:
+ content = f.read()
+
+ # Find nav section
+ nav_start = content.find('nav:')
+ lines = content[nav_start:].split('\n')
+
+ # Get markdown files
+ md_files = []
+ for line in lines:
+ if '.md' in line:
+ # Extract the markdown filename and clean it up
+ md_file = line.strip().split(':')[-1].strip()
+ # Remove list markers and quotes
+ md_file = md_file.lstrip('- ').strip("'").strip('"')
+ if md_file.endswith('.md'):
+ md_files.append(md_file)
+
+ # Check if files exist
+ missing = []
+ for file in md_files:
+ if not os.path.exists(os.path.join(docs_dir, file)):
+ missing.append(file)
+
+ print("\nChecking files in:", docs_dir)
+ print("Found MD files:", md_files)
+ print("Missing files:", missing)
+
+ assert not missing, f"Missing files: {missing}"
\ No newline at end of file