Skip to content

Raise ValueError instead of assert in geo_to_h3shape - #500

Open
Hashim1999164 wants to merge 1 commit into
uber:masterfrom
Hashim1999164:fix/geo-to-h3shape-replace-assert
Open

Raise ValueError instead of assert in geo_to_h3shape#500
Hashim1999164 wants to merge 1 commit into
uber:masterfrom
Hashim1999164:fix/geo-to-h3shape-replace-assert

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Aug 22, 2026

Copy link
Copy Markdown

Summary

geo_to_h3shape still used assert isinstance(geo, dict), which Bandit flags and which was already marked for removal.

This raises ValueError for invalid inputs instead, matching nearby validation style, and adds a unit test for the rejection path.

Fixes #498

Test plan

  1. Run the polyfill test_h3 suite filtered to geo_to_h3shape cases.
  2. Confirm the existing geo conversion cases and the new rejection case pass.

The leftover assert isinstance check tripped Bandit and was marked for removal. Invalid inputs now get an explicit ValueError.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_h3_shape.py line '311'. Fails check by bandit.

1 participant