MCPcopy
hub / github.com/python-visualization/folium / test_rectangle

Function test_rectangle

tests/test_vector_layers.py:156–218  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

154
155
156def test_rectangle():
157 m = Map()
158
159 location = [[45.6, -122.8], [45.61, -122.7]]
160 rectangle = Rectangle(
161 bounds=location,
162 popup="I am a rectangle",
163 color="black",
164 weight=2,
165 fill_opacity=0.6,
166 opacity=1,
167 fill=True,
168 )
169 rectangle.add_to(m)
170
171 expected_options = {
172 "bubblingMouseEvents": True,
173 "color": "black",
174 "dashArray": None,
175 "dashOffset": None,
176 "fill": True,
177 "fillColor": "black",
178 "fillOpacity": 0.6,
179 "fillRule": "evenodd",
180 "lineCap": "round",
181 "lineJoin": "round",
182 "noClip": False,
183 "opacity": 1,
184 "smoothFactor": 1.0,
185 "stroke": True,
186 "weight": 2,
187 }
188
189 m._repr_html_()
190 expected_rendered = f"""
191 var {rectangle.get_name()} = L.rectangle(
192 {location},
193 {{
194 "bubblingMouseEvents": true,
195 "color": "black",
196 "dashArray": null,
197 "dashOffset": null,
198 "fill": true,
199 "fillColor": "black",
200 "fillOpacity": 0.6,
201 "fillRule": "evenodd",
202 "lineCap": "round",
203 "lineJoin": "round",
204 "noClip": false,
205 "opacity": 1,
206 "smoothFactor": 1.0,
207 "stroke": true,
208 "weight": 2
209 }}
210 )
211 .addTo({m.get_name()});
212 """
213

Callers

nothing calls this directly

Calls 6

_repr_html_Method · 0.95
MapClass · 0.90
RectangleClass · 0.90
normalizeFunction · 0.90
add_toMethod · 0.80
get_boundsMethod · 0.80

Tested by

no test coverage detected