How to use the h3.h3_unidirectional_edge_is_valid function in h3

To help you get started, we’ve selected a few h3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uber / h3-py / tests / test_cells_and_edges.py View on Github external
def test_edges():
    h = '8928308280fffff'

    with pytest.raises(H3ValueError):
        h3.get_h3_unidirectional_edge(h, h)

    h2 = h3.hex_ring(h, 2).pop()
    with pytest.raises(H3ValueError):
        h3.get_h3_unidirectional_edge(h, h2)

    e_bad = '14928308280ffff1'
    assert not h3.h3_unidirectional_edge_is_valid(e_bad)

    with pytest.raises(H3EdgeError):
        h3.get_origin_h3_index_from_unidirectional_edge(e_bad)

    with pytest.raises(H3EdgeError):
        h3.get_destination_h3_index_from_unidirectional_edge(e_bad)

    with pytest.raises(H3EdgeError):
        h3.get_h3_indexes_from_unidirectional_edge(e_bad)
github uber / h3-py / tests / test_h3.py View on Github external
def test_h3_unidirectional_edge_is_valid():
    assert not h3.h3_unidirectional_edge_is_valid('8928308280fffff')
    assert h3.h3_unidirectional_edge_is_valid('11928308280fffff')
github uber / h3-py / tests / test_h3.py View on Github external
def test_get_h3_unidirectional_edge():
    out = h3.get_h3_unidirectional_edge('8928308280fffff', '8928308280bffff')
    assert h3.h3_unidirectional_edge_is_valid(out)

    with pytest.raises(ValueError):
        h3.get_h3_unidirectional_edge('821c07fffffffff', '8928308280fffff')
github uber / h3-py / tests / test_h3.py View on Github external
def test_h3_unidirectional_edge_is_valid():
    assert not h3.h3_unidirectional_edge_is_valid('8928308280fffff')
    assert h3.h3_unidirectional_edge_is_valid('11928308280fffff')
github uber / h3-py / tests / test_cells_and_edges.py View on Github external
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)
github uber / h3-py / tests / test_cells_and_edges.py View on Github external
def test_edge_is_valid_fail():
    e_invalid = {}
    assert not h3.h3_unidirectional_edge_is_valid(e_invalid)