MCPcopy Index your code
hub / github.com/python-visualization/folium / test_choropleth_key_on

Method test_choropleth_key_on

tests/test_folium.py:231–261  ·  view source on GitHub ↗

Test to make sure that Choropleth function doesn't raises a ValueError when the 'key_on' field is set to a column that might have 0 as a value.

(self)

Source from the content-addressed store, hash-verified

229 assert '"fillOpacity":0.543212345' in out_str
230
231 def test_choropleth_key_on(self):
232 """Test to make sure that Choropleth function doesn't raises
233 a ValueError when the 'key_on' field is set to a column that might
234 have 0 as a value.
235 """
236 with open(os.path.join(rootpath, "geo_grid.json")) as f:
237 geo_data = json.load(f)
238 data = pd.DataFrame(
239 {
240 "idx": {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5},
241 "value": {
242 "0": 78.0,
243 "1": 39.0,
244 "2": 0.0,
245 "3": 81.0,
246 "4": 42.0,
247 "5": 68.0,
248 },
249 }
250 )
251 fill_color = "BuPu"
252 columns = ["idx", "value"]
253 key_on = "feature.properties.idx"
254
255 Choropleth(
256 geo_data=geo_data,
257 data=data,
258 key_on=key_on,
259 fill_color=fill_color,
260 columns=columns,
261 )
262
263 def test_choropleth_geopandas_numeric(self):
264 """Test to make sure that Choropleth function does complete the lookup

Callers

nothing calls this directly

Calls 1

ChoroplethClass · 0.90

Tested by

no test coverage detected