async def test_large_file_chunked(self):
        """Test that a large file is properly chunked by the real CodeChunker."""
        # Create a large Python file that exceeds the chunk size limit
        chunk_size_limit = MAX_CHUNK_SIZE - METADATA_SIZE  # This is 7191
        threshold = chunk_size_limit + 100  # Just over the limit
        large_content = generate_large_code_content(threshold)

        file = CodeFileEntity(
            entity_id=str(uuid.uuid4()),
            breadcrumbs=[],
            source_name="test",
            name="test.py",
            file_id="test123",
            size=len(large_content),
            path_in_repo="test.py",
            repo_name="test-repo",
            repo_owner="test-owner",
            url="https://example.com/test.py",
            content=large_content,
            language="python",
            last_modified=datetime.now(),
            commit_id="abc123",
        )

        # Process with the real code chunker
        result = await code_file_chunker(file)

        # Verify chunking happened
        assert len(result) > 1

        # Verify basic metadata is consistent across chunks
        for chunk_file in result:
            assert chunk_file.file_id == file.file_id
            assert chunk_file.source_name == file.source_name
            assert chunk_file.repo_name == file.repo_name
            assert chunk_file.language == file.language

            # Verify chunk metadata exists
            assert "chunk_index" in chunk_file.metadata
            assert "total_chunks" in chunk_file.metadata
            assert "original_file_id" in chunk_file.metadata
            assert "chunk_start_index" in chunk_file.metadata
            assert "chunk_end_index" in chunk_file.metadata

            # Verify each chunk has the right name format
            chunk_idx = chunk_file.metadata["chunk_index"]
            total_chunks = chunk_file.metadata["total_chunks"]
            assert chunk_file.name == f"{file.name} (Chunk {chunk_idx}/{total_chunks})"

            # Verify each chunk is small enough to fit in the model
            chunk_size = count_tokens(chunk_file.model_dump_json())
            assert chunk_size < MAX_CHUNK_SIZE
Test that a large file is properly chunked by the real CodeChunker.
backend/tests/unit/platform/transformers/test_code_file_chunker.py