1import h3.api.basic_int as h3 2 3 4def test_int_output(): 5 lat = 37.7752702151959 6 lng = -122.418307270836 7 8 assert h3.geo_to_h3(lat, lng, 9) == 617700169958293503 9 assert h3.geo_to_h3(lat, lng, 9) == 0x8928308280fffff 10 11 12def test_k_ring(): 13 expected = { 14 617700169957507071, 15 617700169957769215, 16 617700169958031359, 17 617700169958293503, 18 617700169961177087, 19 617700169964847103, 20 617700169965109247, 21 } 22 23 out = h3.k_ring(617700169958293503, 1) 24 assert out == expected 25 26 27def test_compact(): 28 h = 617700169958293503 29 hexes = h3.h3_to_children(h) 30 31 assert h3.compact(hexes) == {h} 32 33 34def test_get_faces(): 35 h = 577832942814887935 36 expected = {2, 3, 7, 8, 12} 37 out = h3.h3_get_faces(h) 38 assert out == expected 39 40 h = 579873636396040191 41 expected = {13} 42 out = h3.h3_get_faces(h) 43 assert out == expected 44 45 h = 579768083279773695 46 expected = {16, 15} 47 out = h3.h3_get_faces(h) 48 assert out == expected 49