Skip to content

Commit

Permalink
grass.jupyter: fix interactivemap tests (#4379)
Browse files Browse the repository at this point in the history
  • Loading branch information
petrasovaa authored Sep 25, 2024
1 parent 8c671ca commit d99d840
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions python/grass/jupyter/testsuite/interactivemap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,26 @@ def test_query_button(self):
# Create InteractiveMap with ipyleaflet backend
interactive_map = gj.InteractiveMap(map_backend="ipyleaflet")
interactive_map.add_raster("elevation")
interactive_map.add_vector("roadsmajor")
interactive_map.add_query_button()
self.assertIsNotNone(interactive_map.map)
self.assertTrue(interactive_map.query_mode is False)
# Toggle query button to activate
interactive_map.query_mode = True
self.assertTrue(interactive_map.query_mode)
# Toggle query button to deactivate
interactive_map.query_mode = False
self.assertFalse(interactive_map.query_mode)
button = interactive_map.setup_query_interface()
self.assertIsNotNone(interactive_map._controllers[button].query_raster((0, 0)))

@unittest.skipIf(not can_import_ipyleaflet(), "Cannot import ipyleaflet")
def test_draw(self):
"""Test the draw_computational_region method."""
# Create InteractiveMap
interactive_map = gj.InteractiveMap(map_backend="ipyleaflet")
button = interactive_map.setup_drawing_interface()
interactive_map._controllers[button].activate()
self.assertIsNotNone(interactive_map._controllers[button].save_button_control)

@unittest.skipIf(not can_import_ipyleaflet(), "Cannot import ipyleaflet")
def test_draw_computational_region(self):
"""Test the draw_computational_region method."""
# Create InteractiveMap
interactive_map = gj.InteractiveMap()
interactive_map.draw_computational_region()
self.assertTrue(callable(interactive_map.draw_computational_region))
interactive_map = gj.InteractiveMap(map_backend="ipyleaflet")
button = interactive_map.setup_computational_region_interface()
interactive_map._controllers[button].activate()
self.assertIsNotNone(interactive_map._controllers[button].save_button_control)


if __name__ == "__main__":
Expand Down

0 comments on commit d99d840

Please sign in to comment.