Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions quartodoc/builder/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ def _to_simple_dict(el: "BaseModel"):


def _non_default_entries(el: Auto):
d = el.dict()

return {k: d[k] for k in el._fields_specified}
return {k: getattr(el, k) for k in el._fields_specified}


class BlueprintTransformer(PydanticTransformer):
Expand Down
18 changes: 18 additions & 0 deletions quartodoc/tests/test_builder_blueprint.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from quartodoc import get_object
from quartodoc import layout as lo
from quartodoc.builder.blueprint import (
_non_default_entries,
BlueprintTransformer,
blueprint,
WorkaroundKeyError,
Expand Down Expand Up @@ -37,6 +38,23 @@ def bp():
return BlueprintTransformer()


def test_non_default_entries_auto():
assert _non_default_entries(lo.Auto(name="a_func", include_attributes=False)) == {
"name": "a_func",
"include_attributes": False,
}


def test_non_default_entries_auto_member_options():
# these entries are nested inside auto
res = _non_default_entries(
lo.Auto(name="a_func", member_options={"include_attributes": False})
)

assert res["name"] == "a_func"
assert _non_default_entries(res["member_options"]) == {"include_attributes": False}


@pytest.mark.parametrize("path", ["quartodoc.get_object", "quartodoc:get_object"])
def test_blueprint_basic(bp, path):
auto = lo.Auto(name=path)
Expand Down