diff --git a/docs/examples/data_transfer_objects/factory/paginated_return_data.py b/docs/examples/data_transfer_objects/factory/paginated_return_data.py
index a9624e69d5..4cce44ec92 100644
--- a/docs/examples/data_transfer_objects/factory/paginated_return_data.py
+++ b/docs/examples/data_transfer_objects/factory/paginated_return_data.py
@@ -1,13 +1,15 @@
 from datetime import datetime
 
-from sqlalchemy.orm import Mapped
+from sqlalchemy.orm import DeclarativeBase, Mapped
 
 from litestar import Litestar, get
+from litestar.contrib.sqlalchemy.base import CommonTableAttributes, UUIDPrimaryKey
 from litestar.contrib.sqlalchemy.dto import SQLAlchemyDTO
 from litestar.dto import DTOConfig
 from litestar.pagination import ClassicPagination
 
-from .my_lib import Base
+
+class Base(CommonTableAttributes, UUIDPrimaryKey, DeclarativeBase): ...
 
 
 class User(Base):
diff --git a/docs/usage/dto/1-abstract-dto.rst b/docs/usage/dto/1-abstract-dto.rst
index 4ae382d9b5..62a6a63768 100644
--- a/docs/usage/dto/1-abstract-dto.rst
+++ b/docs/usage/dto/1-abstract-dto.rst
@@ -352,9 +352,14 @@ Working with Litestar's Pagination Types
 Litestar offers paginated response wrapper types, and DTO Factory types can handle this out of the box.
 
 .. literalinclude:: /examples/data_transfer_objects/factory/paginated_return_data.py
-    :caption: Paginated Return Data
     :language: python
-    :linenos:
+    :lines: 9-11,26-40
+
+.. dropdown:: Full code
+
+    .. literalinclude:: /examples/data_transfer_objects/factory/paginated_return_data.py
+        :language: python
+        :emphasize-lines: 9,26-40
 
 The DTO is defined and configured, in our example, we're excluding ``password`` and ``created_at`` fields from the final
 representation of our users.
diff --git a/tests/examples/test_data_transfer_objects/test_factory/test_paginated_return_data.py b/tests/examples/test_data_transfer_objects/test_factory/test_paginated_return_data.py
new file mode 100644
index 0000000000..a14d9b5131
--- /dev/null
+++ b/tests/examples/test_data_transfer_objects/test_factory/test_paginated_return_data.py
@@ -0,0 +1,17 @@
+from litestar.status_codes import HTTP_200_OK
+from litestar.testing.client import TestClient
+
+
+def test_create_user() -> None:
+    from docs.examples.data_transfer_objects.factory.paginated_return_data import app
+
+    with TestClient(app=app) as client:
+        response = client.get("/users")
+
+    assert response.status_code == HTTP_200_OK
+    assert response.json() == {
+        "current_page": 1,
+        "items": [{"id": 1, "name": "Litestar User"}],
+        "page_size": 10,
+        "total_pages": 1,
+    }