Skip to content

Commit

Permalink
grassTask.get_param(): full match also for strings (OSGeo#3582)
Browse files Browse the repository at this point in the history
* script.task: Create test file grassTask.get_param()

Co-authored-by: Edouard Choinière <[email protected]>
  • Loading branch information
landam and echoix authored May 11, 2024
1 parent 43be353 commit 817af48
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 0 additions & 3 deletions python/grass/script/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ def get_param(self, value, element="name", raiseError=True):
if isinstance(val, (list, tuple)):
if value in val:
return p
elif isinstance(val, (bytes, str)):
if p[element][: len(value)] == value:
return p
else:
if p[element] == value:
return p
Expand Down
11 changes: 11 additions & 0 deletions python/grass/script/tests/test_script_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from grass.script.task import grassTask as gtask


def test_mapcalc_simple_e_name():
gt = gtask("r.mapcalc.simple")
assert gt.get_param("e")["name"] == "e"


def test_mapcalc_simple_expession_name():
gt = gtask("r.mapcalc.simple")
assert gt.get_param("expression")["name"] == "expression"

0 comments on commit 817af48

Please sign in to comment.