File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -117,9 +117,7 @@ def _to_simple_dict(el: "BaseModel"):
117117
118118
119119def _non_default_entries (el : Auto ):
120- d = el .dict ()
121-
122- return {k : d [k ] for k in el ._fields_specified }
120+ return {k : getattr (el , k ) for k in el ._fields_specified }
123121
124122
125123class BlueprintTransformer (PydanticTransformer ):
Original file line number Diff line number Diff line change 11from quartodoc import get_object
22from quartodoc import layout as lo
33from quartodoc .builder .blueprint import (
4+ _non_default_entries ,
45 BlueprintTransformer ,
56 blueprint ,
67 WorkaroundKeyError ,
@@ -37,6 +38,23 @@ def bp():
3738 return BlueprintTransformer ()
3839
3940
41+ def test_non_default_entries_auto ():
42+ assert _non_default_entries (lo .Auto (name = "a_func" , include_attributes = False )) == {
43+ "name" : "a_func" ,
44+ "include_attributes" : False ,
45+ }
46+
47+
48+ def test_non_default_entries_auto_member_options ():
49+ # these entries are nested inside auto
50+ res = _non_default_entries (
51+ lo .Auto (name = "a_func" , member_options = {"include_attributes" : False })
52+ )
53+
54+ assert res ["name" ] == "a_func"
55+ assert _non_default_entries (res ["member_options" ]) == {"include_attributes" : False }
56+
57+
4058@pytest .mark .parametrize ("path" , ["quartodoc.get_object" , "quartodoc:get_object" ])
4159def test_blueprint_basic (bp , path ):
4260 auto = lo .Auto (name = path )
You can’t perform that action at this time.
0 commit comments