Repository navigation
Conversation
Cats.delete() checked the category with `if cat:`, so deleting category 0 removed every category of the layer instead. CatsList.from_array() passed a Python list to Vect_array_to_cat_list and always raised ctypes.ArgumentError.
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.
Description
Cats.delete()tested the category withif cat:, sodelete(0)fell through toVect_cat_deland removed every category of the layer; when category 0 was not present it still wiped the layer without raising. The check is nowcat is not None.CatsList.from_array()passed a Python list straight toVect_array_to_cat_list, which raisedctypes.ArgumentError. It now builds ac_intarray first.Motivation and context
Category 0 is a valid category number, and
from_array()had never worked (it was markedTODO: it's not working).Fixes #8074
How has this been tested?
Added five tests to
python/grass/pygrass/vector/tests/test_basic.py:delete(0)leaves the other categories,delete(0)on a layer without it raisesValueErrorand keeps the layer intact,delete(layer=1)still clears the layer, andfrom_arraywith a ranged list and with an empty list. Four of them fail onmainand all pass with this change; the rest oftest_basic.py(47 tests) and the module doctests pass. ruff/flake8 clean.Types of changes
Checklist