Skip to content

Raise ValueError instead of assert in geo_to_h3shape - #500

Merged
jongbinjung merged 1 commit into
uber:masterfrom
Hashim1999164:fix/geo-to-h3shape-replace-assert
Aug 24, 2026
Merged

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

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

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.
@jongbinjung
jongbinjung merged commit 51dbbeb into uber:master Aug 24, 2026
41 checks passed
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.

2 participants