@@ -198,6 +198,11 @@ def _create_map(self):
198198 attrs .update (self ._autozoom ())
199199 attrs .update (self ._attrs .copy ())
200200
201+ # If tiles is a custom string provider, ensure an attribution is present
202+ # Folium/TileLayer raises ValueError if attr is falsy for custom tiles.
203+ if 'tiles' in attrs and isinstance (attrs ['tiles' ], str ) and not attrs .get ('attr' ):
204+ attrs ['attr' ] = ' ' # non-empty string avoids folium's "must have an attribution" check
205+
201206 # Enforce zoom consistency
202207 attrs ['max_zoom' ] = max (attrs ['zoom_start' ]+ 2 , attrs ['max_zoom' ])
203208 attrs ['min_zoom' ] = min (attrs ['zoom_start' ]- 2 , attrs ['min_zoom' ])
@@ -533,12 +538,16 @@ def _folium_kwargs(self):
533538 if 'color' in icon_args and icon_args ['color' ][0 ] == '#' :
534539 # Checks if color provided is a hex code instead; if it is, uses BeautifyIcon to create markers.
535540 # If statement does not check to see if color is an empty string.
536- icon_args ['background_color' ] = icon_args ['border_color' ] = icon_args .pop ('color' )
537- if icon_args ['background_color' ][1 ] == icon_args ['background_color' ][3 ] == icon_args ['background_color' ][5 ] == 'f' :
538- icon_args ['text_color' ] = 'gray'
541+ # BeautifyIcon expects camelCase option names like 'backgroundColor',
542+ # 'borderColor', 'textColor', and 'iconShape'. Use those keys so
543+ # the resulting `.options` dict contains the expected names used in tests.
544+ color_val = icon_args .pop ('color' )
545+ icon_args ['backgroundColor' ] = icon_args ['borderColor' ] = color_val
546+ if color_val [1 ] == color_val [3 ] == color_val [5 ] == 'f' :
547+ icon_args ['textColor' ] = 'gray'
539548 else :
540- icon_args ['text_color ' ] = 'white'
541- icon_args ['icon_shape ' ] = 'marker'
549+ icon_args ['textColor ' ] = 'white'
550+ icon_args ['iconShape ' ] = 'marker'
542551 if 'icon' not in icon_args :
543552 icon_args ['icon' ] = 'circle'
544553 attrs ['icon' ] = BeautifyIcon (** icon_args )
0 commit comments