fss-mini-rag-github/tests/test_min_chunk_size.py
FSSCoding 930f53a0fb Major code quality improvements and structural organization
- Applied Black formatter and isort across entire codebase for professional consistency
- Moved implementation scripts (rag-mini.py, rag-tui.py) to bin/ directory for cleaner root
- Updated shell scripts to reference new bin/ locations maintaining user compatibility
- Added comprehensive linting configuration (.flake8, pyproject.toml) with dedicated .venv-linting
- Removed development artifacts (commit_message.txt, GET_STARTED.md duplicate) from root
- Consolidated documentation and fixed script references across all guides
- Relocated test_fixes.py to proper tests/ directory
- Enhanced project structure following Python packaging standards

All user commands work identically while improving code organization and beginner accessibility.
2025-08-28 15:29:54 +10:00

31 lines
691 B
Python

"""Test with smaller min_chunk_size."""
from pathlib import Path
from mini_rag.chunker import CodeChunker
test_code = '''"""Test module."""
import os
class MyClass:
def method(self):
return 42
def my_function():
return "hello"
'''
# Create chunker with smaller min_chunk_size
chunker = CodeChunker(min_chunk_size=1) # Allow tiny chunks
chunks = chunker.chunk_file(Path("test.py"), test_code)
print(f"Created {len(chunks)} chunks:")
for i, chunk in enumerate(chunks):
print(f"\nChunk {i}: {chunk.chunk_type} '{chunk.name}'")
print(f"Lines {chunk.start_line}-{chunk.end_line}")
print(f"Size: {len(chunk.content.splitlines())} lines")
print("-" * 40)