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_indexes_are_neighbors():
assert h3.h3_indexes_are_neighbors('8928308280fffff', '8928308280bffff')
assert not h3.h3_indexes_are_neighbors('821c07fffffffff', '8928308280fffff')
def test_validation2():
h = '8928308280fffff'
with pytest.raises(H3ResolutionError):
h3.h3_to_children(h, 17)
assert not h3.h3_indexes_are_neighbors(h, h)
def test_h3_indexes_are_neighbors():
assert h3.h3_indexes_are_neighbors('8928308280fffff', '8928308280bffff')
assert not h3.h3_indexes_are_neighbors('821c07fffffffff', '8928308280fffff')
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_validation_geo():
h = '8a28308280fffff' # invalid cell
with pytest.raises(H3CellError):
h3.h3_to_geo(h)
with pytest.raises(H3ResolutionError):
h3.geo_to_h3(0, 0, 17)
with pytest.raises(H3CellError):
h3.h3_to_geo_boundary(h)
with pytest.raises(H3CellError):
h3.h3_indexes_are_neighbors(h, h)
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)