Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_h3_is_valid():
assert h3.h3_is_valid('85283473fffffff')
assert h3.h3_is_valid('850dab63fffffff')
assert not h3.h3_is_valid('lolwut')
# H3 0.x Addresses are not considered valid
assert not h3.h3_is_valid('5004295803a88')
for res in range(16):
assert h3.h3_is_valid(h3.geo_to_h3(37, -122, 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)
def test_edge():
h1 = '8928308280fffff'
h2 = '89283082873ffff'
assert not h3.h3_indexes_are_neighbors(h1, h1)
assert h3.h3_indexes_are_neighbors(h1, h2)
e = h3.get_h3_unidirectional_edge(h1, h2)
assert e == '12928308280fffff'
assert h3.h3_unidirectional_edge_is_valid(e)
assert not h3.h3_is_valid(e)
assert h3.get_origin_h3_index_from_unidirectional_edge(e) == h1
assert h3.get_destination_h3_index_from_unidirectional_edge(e) == h2
assert h3.get_h3_indexes_from_unidirectional_edge(e) == (h1, h2)
def test_h3_is_valid():
assert h3.h3_is_valid('85283473fffffff')
assert h3.h3_is_valid('850dab63fffffff')
assert not h3.h3_is_valid('lolwut')
# H3 0.x Addresses are not considered valid
assert not h3.h3_is_valid('5004295803a88')
for res in range(16):
assert h3.h3_is_valid(h3.geo_to_h3(37, -122, 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)
def test_h3_is_valid():
assert h3.h3_is_valid('85283473fffffff')
assert h3.h3_is_valid('850dab63fffffff')
assert not h3.h3_is_valid('lolwut')
# H3 0.x Addresses are not considered valid
assert not h3.h3_is_valid('5004295803a88')
for res in range(16):
assert h3.h3_is_valid(h3.geo_to_h3(37, -122, res))
def test_hex2int_fail():
h_invalid = {}
assert not h3.h3_is_valid(h_invalid)