Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test9():
assert h3.h3_get_resolution('8928308280fffff') == 9
assert h3.h3_get_resolution('8a28308280f7fff') == 10
lambda h: h3.h3_get_resolution(h) == 0,
out
def test9():
assert h3.h3_get_resolution('8928308280fffff') == 9
assert h3.h3_get_resolution('8a28308280f7fff') == 10
def test_validation():
h = '8a28308280fffff' # invalid cell
with pytest.raises(H3CellError):
h3.h3_get_base_cell(h)
with pytest.raises(H3CellError):
h3.h3_get_resolution(h)
with pytest.raises(H3CellError):
h3.h3_to_parent(h, 9)
with pytest.raises(H3CellError):
h3.h3_distance(h, h)
with pytest.raises(H3CellError):
h3.k_ring(h, 1)
with pytest.raises(H3CellError):
h3.hex_ring(h, 1)
with pytest.raises(H3CellError):
h3.h3_to_children(h, 11)
def test_h3_get_resolution():
for res in range(16):
h = h3.geo_to_h3(37.3615593, -122.0553238, res)
assert h3.h3_get_resolution(h) == res
def test8():
assert h3.h3_is_valid('89283082803ffff')
assert not h3.h3_is_valid('abc')
# looks like it might be valid, but it isn't!
h_bad = '8a28308280fffff'
assert not h3.h3_is_valid(h_bad)
# other methods should validate and raise exception if bad input
with pytest.raises(H3CellError):
h3.h3_get_resolution(h_bad)