-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |