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

Function test_deep_copy

tests/test_utilities.py:158–177  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

156
157
158def test_deep_copy():
159 m = Map()
160 fg = FeatureGroup().add_to(m)
161 Marker(location=(0, 0)).add_to(fg)
162 m_copy = deep_copy(m)
163
164 def check(item, item_copy):
165 assert type(item) is type(item_copy)
166 assert item._name == item_copy._name
167 for attr in item.__dict__.keys():
168 if not attr.startswith("_"):
169 assert getattr(item, attr) == getattr(item_copy, attr)
170 assert item is not item_copy
171 assert item._id != item_copy._id
172 for child, child_copy in zip(
173 item._children.values(), item_copy._children.values()
174 ):
175 check(child, child_copy)
176
177 check(m, m_copy)
178
179
180def test_get_obj_in_upper_tree():

Callers

nothing calls this directly

Calls 6

MapClass · 0.90
FeatureGroupClass · 0.90
MarkerClass · 0.90
deep_copyFunction · 0.90
checkFunction · 0.85
add_toMethod · 0.80

Tested by

no test coverage detected