Skip to content

Commit

Permalink
test_icosahedron_faces
Browse files Browse the repository at this point in the history
  • Loading branch information
ajfriend committed Mar 9, 2024
1 parent 1461e3d commit 146a83c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/test_apis/test_ico_faces.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import h3


def test_icosahedron_faces():
"""
get_icosahedron_faces is kind of a special case, because it always returns
a list of integers no matter the API
"""
answers = {
'804dfffffffffff': [2, 3, 7, 8, 12],
'80c1fffffffffff': [13],
'80bbfffffffffff': [15, 16],
}

interfaces = [
(h3.api.basic_str, lambda x: x),
(h3.api.basic_int, h3.str_to_int),
(h3.api.memview_int, h3.str_to_int),
(h3.api.numpy_int, h3.str_to_int),
]

for api, conv in interfaces:
for h in answers:
expected = answers[h]

h = conv(h) # convert to int or str, depending on API
out = api.get_icosahedron_faces(h)

assert isinstance(out, list)
assert set(out) == set(expected)

0 comments on commit 146a83c

Please sign in to comment.