lib: fix incorrect backend detection in get_backend()#7240
Open
Photon079 wants to merge 1 commit intoOSGeo:mainfrom
Open
lib: fix incorrect backend detection in get_backend()#7240Photon079 wants to merge 1 commit intoOSGeo:mainfrom
Photon079 wants to merge 1 commit intoOSGeo:mainfrom
Conversation
Previously, get_backend() would return 'ipyleaflet' whenever folium import failed, without checking if the object was an ipyleaflet.Map. This could cause crashes in Layer.add_to() methods when wrong backend was selected. This fix: - Properly checks object types for both folium and ipyleaflet - Raises clear ValueError when neither backend matches - Adds comprehensive tests covering all edge cases - Follows GRASS coding standards Bug discovered while writing tests - original logic made dangerous assumptions that could break map functionality. AI assistance used for codebase understanding and test design. All code changes and testing were performed by the contributor.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously,
get_backend()returned"ipyleaflet"whenfoliumimport failed, without validating whether the object was actually anipyleaflet.Map. This could lead to incorrect backend selection and failures in layer operations.This fix:
This issue was discovered while writing tests for
grass.jupyteras part of the GSoC test-of-skills tasks. I have also opened issue #7239 for tracking this bug.