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"):
117
117
118
118
119
119
def _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 }
123
121
124
122
125
123
class BlueprintTransformer (PydanticTransformer ):
Original file line number Diff line number Diff line change 1
1
from quartodoc import get_object
2
2
from quartodoc import layout as lo
3
3
from quartodoc .builder .blueprint import (
4
+ _non_default_entries ,
4
5
BlueprintTransformer ,
5
6
blueprint ,
6
7
WorkaroundKeyError ,
@@ -37,6 +38,23 @@ def bp():
37
38
return BlueprintTransformer ()
38
39
39
40
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
+
40
58
@pytest .mark .parametrize ("path" , ["quartodoc.get_object" , "quartodoc:get_object" ])
41
59
def test_blueprint_basic (bp , path ):
42
60
auto = lo .Auto (name = path )
You can’t perform that action at this time.
0 commit comments