File tree 2 files changed +37
-1
lines changed
tests/test_core/test_graph_objs
2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -2619,7 +2619,19 @@ def _get_prop_validator(self, prop):
2619
2619
-------
2620
2620
BaseValidator
2621
2621
"""
2622
- return self ._validators [prop ]
2622
+
2623
+ # Handle remapping
2624
+ # ----------------
2625
+ if prop in self ._mapped_properties :
2626
+ prop_path = self ._mapped_properties [prop ]
2627
+ plotly_obj = self [prop_path [:- 1 ]]
2628
+ prop = prop_path [- 1 ]
2629
+ else :
2630
+ plotly_obj = self
2631
+
2632
+ # Return validator
2633
+ # ----------------
2634
+ return plotly_obj ._validators [prop ]
2623
2635
2624
2636
@property
2625
2637
def parent (self ):
Original file line number Diff line number Diff line change @@ -59,6 +59,14 @@ def test_title_as_string_layout(self):
59
59
self .assertEqual (obj .to_plotly_json (),
60
60
{'title' : {'text' : 'A title 2' }})
61
61
62
+ # Update titlefont
63
+ obj .update (titlefont = {'size' : 23 })
64
+ self .assertEqual (obj .title .font .size , 23 )
65
+ self .assertEqual (obj .to_plotly_json (),
66
+ {'title' :
67
+ {'text' : 'A title 2' ,
68
+ 'font' : {'size' : 23 }}})
69
+
62
70
# Pie
63
71
obj = go .Pie ()
64
72
obj .title = 'A title'
@@ -67,6 +75,22 @@ def test_title_as_string_layout(self):
67
75
{'title' : {'text' : 'A title' },
68
76
'type' : 'pie' })
69
77
78
+ # And update
79
+ obj .update (title = 'A title 2' )
80
+ self .assertEqual (obj .title .text , 'A title 2' )
81
+ self .assertEqual (obj .to_plotly_json (),
82
+ {'type' : 'pie' ,
83
+ 'title' : {'text' : 'A title 2' }})
84
+
85
+ # Update titlefont
86
+ obj .update (titlefont = {'size' : 23 })
87
+ self .assertEqual (obj .title .font .size , 23 )
88
+ self .assertEqual (obj .to_plotly_json (),
89
+ {'type' : 'pie' ,
90
+ 'title' :
91
+ {'text' : 'A title 2' ,
92
+ 'font' : {'size' : 23 }}})
93
+
70
94
def test_legacy_title_props_remapped (self ):
71
95
72
96
# plain Layout
You can’t perform that action at this time.
0 commit comments