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)
| 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 |