Skip to content

Commit

Permalink
grassTask.get_param(): full match also for strings (#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 committed May 11, 2024
1 parent dc46008 commit 471cb29
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 @@ -160,9 +160,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, unicode)):
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 471cb29

Please sign in to comment.