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

Method test_topo_json_smooth_factor

tests/test_folium.py:176–191  ·  view source on GitHub ↗

Test topojson smooth factor method.

(self)

Source from the content-addressed store, hash-verified

174 assert bounds == [[45, -30], [45, 30]], bounds
175
176 def test_topo_json_smooth_factor(self):
177 """Test topojson smooth factor method."""
178 self.m = folium.Map([43, -100], zoom_start=4)
179
180 # Adding TopoJSON as additional layer.
181 with open(os.path.join(rootpath, "or_counties_topo.json")) as f:
182 choropleth = Choropleth(
183 f, topojson="objects.or_counties_geo", smooth_factor=0.5
184 ).add_to(self.m)
185
186 out = self.m._parent.render()
187
188 # Verify TopoJson
189 topo_json = choropleth.geojson
190 topojson_str = topo_json._template.module.script(topo_json)
191 assert "".join(topojson_str.split())[:-1] in "".join(out.split())
192
193 def test_choropleth_features(self):
194 """Test to make sure that Choropleth function doesn't allow

Callers

nothing calls this directly

Calls 3

ChoroplethClass · 0.90
add_toMethod · 0.80
renderMethod · 0.45

Tested by

no test coverage detected