From 2f62194f0f29c8a8b05439c489604ef2d7a391be Mon Sep 17 00:00:00 2001 From: dyrpsf Date: Tue, 28 Jul 2026 08:34:00 +0530 Subject: [PATCH 1/3] test: add test for uncompacting cells to a coarser resolution --- src/h3/api/basic_int/__init__.py | 2 -- tests/test_lib/test_cells_and_edges.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/h3/api/basic_int/__init__.py b/src/h3/api/basic_int/__init__.py index 1086a632..ef827925 100644 --- a/src/h3/api/basic_int/__init__.py +++ b/src/h3/api/basic_int/__init__.py @@ -474,8 +474,6 @@ def uncompact_cells(cells, res): ----- There is currently no guaranteed order of the output cells. """ - # TODO: add test to make sure an error is returned when input contains cell - # smaller than output res. hc = _in_collection(cells) hu = _cy.uncompact_cells(hc, res) diff --git a/tests/test_lib/test_cells_and_edges.py b/tests/test_lib/test_cells_and_edges.py index 4b8e1075..240a638f 100644 --- a/tests/test_lib/test_cells_and_edges.py +++ b/tests/test_lib/test_cells_and_edges.py @@ -755,3 +755,13 @@ def test_construct_cell_inverses_int_api(): def test_center_child_with_deconstruct(): for h in h3.get_res0_cells(): h3.construct_cell(*h3.deconstruct_cell(h), 0) == h3.cell_to_center_child(h) + + +def test_uncompact_cells_invalid_resolution(): + # Create a valid cell at resolution 5 + h_res5 = h3.latlng_to_cell(0, 0, 5) + + # Attempting to uncompact to a coarser resolution (4) + # should raise an H3ResDomainError + with pytest.raises(H3ResDomainError): + h3.uncompact_cells({h_res5}, 4) From 58be699d132f952e186757a5eeaf2bd455857e8d Mon Sep 17 00:00:00 2001 From: Deepak Yadav Date: Sat, 1 Aug 2026 21:11:58 +0530 Subject: [PATCH 2/3] Update tests/test_lib/test_cells_and_edges.py Co-authored-by: Isaac Brodsky --- tests/test_lib/test_cells_and_edges.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_lib/test_cells_and_edges.py b/tests/test_lib/test_cells_and_edges.py index 240a638f..2b106e6b 100644 --- a/tests/test_lib/test_cells_and_edges.py +++ b/tests/test_lib/test_cells_and_edges.py @@ -763,5 +763,5 @@ def test_uncompact_cells_invalid_resolution(): # Attempting to uncompact to a coarser resolution (4) # should raise an H3ResDomainError - with pytest.raises(H3ResDomainError): + with pytest.raises(H3ResMismatchError): h3.uncompact_cells({h_res5}, 4) From 5dc46e4f287772f6bef6090ec96b3d2219428485 Mon Sep 17 00:00:00 2001 From: dyrpsf Date: Mon, 3 Aug 2026 21:43:59 +0530 Subject: [PATCH 3/3] test: update comment to match H3ResMismatchError --- tests/test_lib/test_cells_and_edges.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_lib/test_cells_and_edges.py b/tests/test_lib/test_cells_and_edges.py index 2b106e6b..77e8f5ed 100644 --- a/tests/test_lib/test_cells_and_edges.py +++ b/tests/test_lib/test_cells_and_edges.py @@ -762,6 +762,6 @@ def test_uncompact_cells_invalid_resolution(): h_res5 = h3.latlng_to_cell(0, 0, 5) # Attempting to uncompact to a coarser resolution (4) - # should raise an H3ResDomainError + # should raise an H3ResMismatchError with pytest.raises(H3ResMismatchError): h3.uncompact_cells({h_res5}, 4)