diff --git a/folium/features.py b/folium/features.py index 587f5e053b..43b1516180 100644 --- a/folium/features.py +++ b/folium/features.py @@ -2056,8 +2056,8 @@ def __init__( if position is not None: position = position.lower() # type: ignore - if position not in (args := get_args(TypePosition)): - raise TypeError(f"position must be one of {args}") + if position not in (positions := get_args(TypePosition)): + raise TypeError(f"position must be one of {positions}") kwargs["position"] = position self.args = args diff --git a/tests/test_folium.py b/tests/test_folium.py index 7679140c1e..36a8298c4c 100644 --- a/tests/test_folium.py +++ b/tests/test_folium.py @@ -558,3 +558,7 @@ def test_control_typecheck(self): assert "position must be one of ('bottomright', 'bottomleft'" in str( excinfo.value ) + + def test_control_keeps_args_with_position(self): + control = folium.Control("MiniMap", "layer", position="bottomright") + assert control.args == ("layer",)